Programming :: Creating An Automated Bash Scrpit
Feb 2, 2011
list the used variables.
1. display menu until user quits the script
2. menu would give following options to
a. create backup
b. restore files from backup
c. quit
3. for option a or b user would be required to specify the files and name of the archive]
4. has option to be run with use of parameters if that is the case it will not display menu but carry out required task unless it was not possible to do
5. incase of any errors are encountered it would call external scrpit that would display custom disigned error message.
View 6 Replies
ADVERTISEMENT
Apr 14, 2010
I'm trying to make a automated build-script with bash but i keep getting different errors that I can't seem to figure out. Could anyone please tell me what's wrong with this package of build-scripts? I'm posting the main build-script and attaching the rest of the scripts in a compressed form. The errors mainly comes from the scripts in "/first_installation/usr/share/siem-live/init"
[Code]...
View 2 Replies
View Related
Apr 14, 2010
I'm trying to make a automated build-script with bash but I keep getting different errors that I cant't seem to solve for various reasons. what's wrong with this build-script? I'm posing the main build-script and attaching the rest of the scripts in a compressed form. Buld-script link: [URL]
[Code]....
View 3 Replies
View Related
May 10, 2010
I wrote a script for capturing port 5060 with tshark.Well, it's only a line, but I needed to send a positional var, and I couldn't do it with an alias. Now I need that script to run as a service, so I can start/stop. (Using CentOS)
Code:
#!/bin/bash
#
# capture service
[code]....
One more thing, my goal is to start/stop the service with
Code:
service myservice start|stop
Is that possible? I read that I must use chkconfig.
View 1 Replies
View Related
May 7, 2011
looking to write a dependency map tree that creates a tree structure of object names . This tree will be written to a file and read back to create the tree structure of files . how to write this using bash ?
View 1 Replies
View Related
May 7, 2011
I am trying to create a custom service to manage a minecraft server what runs in a screen session (this is to allow easy console access as opposed to running it as a nohup background process). I am hitting two main issues with this script so far and wondering if anybody is able to shed some light on it, considering I am far from the greatest BASH scripter on Earth.
The issues are related to start and stop. the first issue with start is there is a command run "screen -dmS minecraft java -Xms1024M -Xmx1024M -jar /minecraft/minecraft.jar nogui" what doesn't appear to work, however when run from console (copy and pasted) this command seems to run perfectly. I am uncertain as to why this is not working within the script. Also if run from a script in /minecraft it also appears to work but in the minecraftd script I have created at /etc/init.d it does not work. I think the issue might be related to the location but am not certain on it, nor how to resolve it.
the second issue with stop is that it works sometimes but at other times it does not, overall it seems to work about 30~50% of the time. When it works it passes a couple of disconnection messages to the screen session and then gives the stop command (the command to gracefully terminate the minecraft server). It seems to work more often when using screen that I attach to the minecraft session while it is running but really not sure if this is an issue with my scripting or an issue with how I am passing things to screen.
The full code in /etc/init.d/minecraftd is below
Code:
#!/bin/bash
## Script Information
## Script Author: Berwick East
[code]....
View 9 Replies
View Related
May 15, 2009
Is it possible to create a text based menu layout in bash were it is possible to browse through. The menu list should look something like this:
----------------------------------------
user: root
colour: blue
number: 4
animal: dog
----------------------------------------
At the start the cursor should blink at the r from root so that text can be entered. When pressing the enter the cursor should go to the b from blue and so on. the imported thing is that all the text is visible also beyond the position from the cursor.
View 4 Replies
View Related
Jan 26, 2011
I have a command that outputs n lines of text, and I want to place each line into an array element, but I can't seem to get the syntax correct
So my command is this:
cat $configfile | sed -n '/cluster:'$clustername'/,/cluster/ p' | awk /host/
Which produces many lines depending on the value of $clustername. I'd like to get each line as elements of an array.
View 5 Replies
View Related
Jan 31, 2011
I am using an automated bash script to upload some files to a remote ftp server . The script is working fine as it is , however I need to check if it uploaded the file successfully or not , so it can remove them. This is the ftp part of the script which is working fine for uploading files.
[Code]...
View 2 Replies
View Related
Apr 13, 2010
I'm trying to make a automated build-script with bash but i keep getting different errors.
Code:
#!/bin/bash
gpg --import /home/epm/first_installation/config_chroot_sources_local.gpg
gpg --import /home/epm/first_installation/config_chroot_sources_packages-inl-fr.gpg
[code]....
View 5 Replies
View Related
Apr 30, 2010
I am trying to create a script to do the following.. Login to a ftp and download a with the following naming convention xmtvMMDDYY.xml.gzon a daily basis followed by extracting that file. which I can do easy enough with a static filename. but the variable filename is throwing me off. I was planning on doing a mget with wildcard to just grab the entire directory but this found to not be as clean as I had hoped. Mainly due to the admins of the ftp keeping multiple days of the above mentioned file on the site.
View 2 Replies
View Related
May 13, 2010
I am involved in a project where some regression tests are to be automated. Could you please tell me what are the testing tools that are available for doing automated GUI testing in Linux?
View 2 Replies
View Related
Feb 4, 2011
NextPendingConnection () returns a new socket with respect to a new client. This new QSocket is passed to the connect () function which connects it to a SLOT 'xyz' with SIGNAL 'readyRead()'. Now in the SLOT 'xyz' how I am supposed to automate the monitoring of ALL connected sockets to see whether some data is available on them? One pathetic way would be to run all the sockets through a for loop and check each one of them for the data. Secondly, I read up on QSocketNotifier() here: [URL]. But I am not sure if that is the correct thing.
View 3 Replies
View Related
Dec 1, 2015
how to do in Debian
1. am required to create a bash-shell script called terminator that terminates all processes of a name given to the shell script as an argument. Make sure the terminator shell script will not take any crucial file system services as arguments.
2. Show how you would configure an Ethernet card by reapplying your existing IP and network mask
3. Install a workable nfs file sharing system between your system and a remote system, using optimum values for resize and wsize.To demonstrate send a 512Mb block of random data between client and server using the dd command.Write down the relevant steps and procedures
View 6 Replies
View Related
Apr 20, 2011
you can make a file that runs the contents as if typed out by the user in command prompt by saving the file as either .bat or .cmd . When using BASH in ubuntu, is it possible to save terminal executable files (from a text editor, like GEDIT), What file ending does it take, can i lay it out with just commands? (what is the syntax)
View 3 Replies
View Related
Feb 4, 2011
I would like to know how do I print the line # in a script. My requirement is, I have a script which is about ~5000 lines long. If there are any errors happen I just exit. And I would like to add the line # of the script where the error happened.
View 3 Replies
View Related
Jan 24, 2010
simple bash code:
Code:
#!/bin/bash
trap "echo 'you got me'" SIGINT SIGTERM # to trap ctrl+c
echo "Press ctrl+c during 5 sec loop"
for ((i=0;i<5;i++)); do
[Code]...
How come code behaves normally and stops when ctrl+c signal is caught and resumes, but after I use at least one timeout read in the code it looks like, if signal is caught again it doesn't pause the execution but skips the loop. If you remove -t (timeout) option from the read, both loops look the same!
View 10 Replies
View Related
Apr 21, 2011
Code:
#!/bin/bash
echo 'obase=2;10'|bc
[code]...
View 2 Replies
View Related
Nov 26, 2008
I have a config file that contains:
my.config:
Code:
Now in my bash script, I want to get the output /home/user instead of $HOME once read. So far, I have managed to get the $HOME variable but I can't get it to echo the variable. All I get is the output $HOME.
Here is my parse_cmd script:
Code:
View 3 Replies
View Related
Jul 25, 2011
I have written quite a few separate bash & scripts and php scripts that up to now I have run from cron jobs. However I have to estimate how long each takes to run, before running the next and so it probably takes much longer than necessary to run them all. They have to run in order.
Now there are so many I am thinking it would be better to have a master bash script that would run one after the other, but I am not sure how to get the master script to wait before starting to run the next script. Is this possible and is there a command that will make the script wait between bash and php scripts , for them to finish, before running the next?
View 5 Replies
View Related
Feb 26, 2011
I just set up apache on my PC and I cant change the permissions by right clicking because "I'm not the owner" and instead of using the chmod command on every file that I would like to edit I would just like to write a script on a text file, save it to my desktop so all I have to do is double click on it and boom I can edit all my files, etc.
View 2 Replies
View Related
Aug 12, 2011
nested loop in ''Bash-Scripting in Linux'' ?What's wrong with my code:
for x in `seq 0.75 0.01 0.95`
do
for y in `seq 0.20 0.01 0.40`
[code]....
View 1 Replies
View Related
Jan 9, 2010
I would like to get the filename (without extension) and the extension separately. The best solution I found so far is:
Let FILE="thefilenameofsomefilesfor_instance.txt"
Code:
NAME=`echo "$FILE" | cut -d'.' -f1`
EXTENSION=`echo "$FILE" | cut -d'.' -f2`
I think it would be better to count the len and remove 3 chars to right to get the extension, but it can be macintosh filenames with have 4 chars for extensions.
View 5 Replies
View Related
Mar 31, 2011
I need to rename the resulted searched files from a loopI have the following code:
find . -name DOC* | while read i
do
find $i -type f -name '*.txt'
done
basically, I am searching for all txt files inside any folder starting with DOC name.this code is working fine with me.I need to rename those .txt files to .txtOLDOS: Ubuntu 10.4Bash shell
View 10 Replies
View Related
Apr 7, 2011
How to create a database using c language it includes structures, pointers, arrays and switch..
View 4 Replies
View Related
Dec 16, 2010
I need to write a small program that eats away at availabe memory. I need to creaty a memory leak to test how other programs cope. I need to run this program on linux and see if the available memory is decreasing.
So I have done:
Code:
int main()
{
int *buffer;
while(1)
[Code]...
View 10 Replies
View Related
Apr 4, 2010
I have 2 questions... I couldn't find answers by Googling (more precisely, by Blackling) and in GCC documents, so I'm asking here.
1. There are 2 flags for position independent code, -fpic and -fPIC. All the examples I read use -fPIC... so when is -fpic useful and what is the difference?
2. Some tutorials use "g++ -shared" while others use "ld" for the creation of the shared library. Why? Does it matter which method I use? Is there a difference? Why does nobody mention both options?
View 11 Replies
View Related
Oct 15, 2010
I need to create a program where the user creates an account and he/she is entitled to add interests and creating friendships with other users.The main algorithm depends on an object which is the user and its attributes are adding interests, friends, so on.Users are stored in a linked list while their interests are stored in another list.What I want to do is every time a new user is created dynamically create a new list during execution for personal info. storage. Is that possible?
View 12 Replies
View Related
May 1, 2009
I am very much interested in operating systems and I am a beginner. I just finished understanding OS concepts. I want to create my own OS. But I am thinking of creating a linux distro first and then going towards complicated things. How I need to equip myself for creating it. What should I know, learn and where to start.
View 6 Replies
View Related
Jan 31, 2010
a)using notepad,prepare a text file with marks for 8 students on seperate lines. The program will then read this file and store all the marks into an array.
b)It will then calculate the average marks.
c)Finally, displays all the marks and average marks on the screen.
would you be kind enough to give me the workout solutions.
View 7 Replies
View Related