General :: Make A Bash Script Into A Daemon
Aug 7, 2011
i've written a script that will move some files from one directory to another, i dont know if this is the right place to ask but, this is on my ipod touch and i'm wondering how to make it run periodicaly
View 6 Replies
ADVERTISEMENT
Jan 5, 2010
I want to create a script which toggles a daemon (here proftpd). On the first execution it should start it and on the next one it should stop it but first check if proftpd is already running or not (and make the decision to start or stop on that).I have created this script:
Code:
#!/bin/sh
# proftpd-toggle
[code]...
View 14 Replies
View Related
Feb 24, 2011
I have a daemon script which wakes up every 5 minutes and checks the health of started processes. It works fine during the day but throws a syntax error just after midnight.Here is the log:
(02/22-23:49) Check all started processes
(02/22-23:54) Check all started processes
(02/22-23:59) Check all started processes
[code]....
View 9 Replies
View Related
Nov 21, 2010
I am attempting to learn how write bash scripts. I want one to ask for a specific key. For example, I want it to ask a question, then if it is like, y for yes, or n for no, it does a specific thing. I'm thinking it would be something like:
Code:
#!/bin/bash
echo "Are you a boy? y/n"
read -t3
View 14 Replies
View Related
May 29, 2011
I'm working in Debian, and I've noticed that when I resize my PuTTY window, the console inside isn't resizing to the new dimentions, so things like nano are running at 80xwhatever instead of the more useful 130xsomething that I've offered it.
View 2 Replies
View Related
Apr 2, 2011
i've written small tool in C which makes measurements on my router (OpenWrt White Russian).
It is working as a deamon. If the tool is started manually, everything works fine. If it is started per script on startup, the following system call doesn't work :
Code: sprintf(command,"/bin/cat /root/%s%s | /usr/bin/ssh -p2222 user(at)host -i /root/.ssh/id_rsa "/bin/cat >> result/%s%s"", apmac, source, apmac, dest);
rc = system (command); the returned rc in this case is 256.
first i thought it is a problems with the user rights for the tool, so i have added +s to it. but that didn't help. as i said, when the daemon is started by hand, the system call works fine.
View 1 Replies
View Related
Apr 3, 2011
How to made a simple website in linux using bash scripting.
View 3 Replies
View Related
Feb 15, 2011
I am administrating a lab in a university and every semester we need to delete all the home folders of the accounts for the next semester. I would like to make a bash script that does this automatically and having trouble with it. Note that I am writing my very first bash script. What I need to do is make a script to delete the following:
Delete everything in /home/$exp$num/$dir
when "exp" could be either "rt", "ic" or "sp".
"num" could run from 1(single digit) to 45 and dir is "profile" and "work".
This is what I tried to write:
Code:
#!/bin/sh
cd /home
for exp in "rt ic sp"
do
[code]....
What seems to be the problem is the reading of "$exp$num" as a joint expression.
View 4 Replies
View Related
Mar 16, 2010
I have a BASH script which at one point asks the user a yes/no question. I want to make it so that if the user types in an invalid input 3 times consecutively then the BASH script will echo an error and terminate with exit status 1.
View 9 Replies
View Related
Jun 25, 2010
I have a startup script for jboss (start.sh) that sets some JAVA_OPTS and then calls bash run.sh.If I run it (start.sh) from the command line it runs in the terminal fine. If I make a shortcut launcher for it in gnome and set it for 'application in terminal' it pops up then immediately dies after launch.Not sure what the problem is. Is this not working because one script is calling a second script? But then why does it work when I call ./start.sh?
View 4 Replies
View Related
Jun 2, 2010
I switched to zsh, but I dislike the completion. If I have 20 files, each with a shared prefix, on pressing tab, zsh will fully complete the first file, then continue going through the list with each press of tab. If I want one near the end, I would have to press tab many times.
In bash, this was simple - press tab and I would get the prefix. If I continued typing (and pressing tab), bash would complete as far as it could be certain of. I find this behavior to be much more intuitive but prefer the other features of zsh to bash.
Is there a way to get this style of completion? Google suggested setopt bash_autolist, but this had no effect for me (and no error message was printed upon starting my shell).
View 1 Replies
View Related
May 1, 2011
bash: how do you make the construct ${var%% *} work? I am trying to select the first word from a variable which contains many space-separated words. I am running Ubuntu 10.10 with GNU bash, version 4.1.5(1)-release (x86_64-pc-linux-gnu) and when I try to use this construct, the expression returns the complete variable with no removal of trailing anything.
View 3 Replies
View Related
Apr 16, 2010
I need to know what is the best method for teaching yourself how to make bash script files
View 8 Replies
View Related
Apr 16, 2010
I need to know what is the best method for how to make bash script files
View 4 Replies
View Related
Apr 18, 2009
I have a program I am writing where I have a for loop and I want to make it substitute the variable twice like:
for ((i=0;i<5;i++)) do
echo $"$i"
done
[code]...
View 3 Replies
View Related
Nov 26, 2009
I'm using bash script now,and I want have a script that can do like this: first ,tell me it will shut down ,and then shut down.My script looks like this:
#!/bin/sh
/usr/bin/curl $stop_page
shutdown -h now
[code]...
View 4 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 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
Jan 14, 2011
How can I iterate over all the files in the current directory to check for certain permissions? This is what I have:
Code: #!/bin/bash
for file in *.tar.gz
do if [ -r "$file" ]
then echo "$file is readable"
else echo "$file is NOT readable"
fi done
But this only checks that the current user has read permissions for each file. I want to check that the group "others" has read permissions for each file. How can I do this? Is there a built in function to check if a file has read permissions for the "others" group? Otherwise, I thought I might be able to use this:
Code: $ stat --format=%a file
744 And parse the output "744" and make sure the 3rd number is between 4 and 7 (since the octals 4-7 have read permissions for others).
View 2 Replies
View Related
Jan 7, 2010
I have OpenSuSE 11.2, and I am learning Bash scripting. I was wondering how I would make a bash program, That I could have it check multiple craigslist sites [western mass, worcester mass, etc], e.g. in the Free category, and/or enter keywords, and have it update every 5 minutes, and then post the results somewhere, to a file, or even upload it to a server, or if it's even possible? (Kind of like the program "Ad Notifier for Craigslist") Would I have to do this in C/C++? If it has to be done in C/C++ It would have to be windows compatible preferably.
View 2 Replies
View Related
Jan 18, 2010
I've tried without luck to get ctrl-backspace working to delete the previous word in bash. I edited my .inputrc and tried the following:
"C-": unix-word-rubout
Control-Rubout: unix-word-rubout
I can make it work if I change it to some other sequence (Control-j: unix-word-rubout makes ^j erase the word), but I can't make it work with backspace.
View 6 Replies
View Related
May 3, 2011
I am relatively new to scripting, but I was wanting to open a firefox window from a bash script, but have it open, then minimize. In the script, I have a single instance of: firefox & but is there a way to minimize it, versus have it displayed on the screen? I was wanting the command terminal to remain visible and it can't since the firefox window is open in front of it. I looked all over the place, including the man pages, but to no avail. I can make the height and width changes, but no minimize. Either that, or to be able to bring the terminal window back to the front automatically.
View 5 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
Aug 31, 2010
This is what I have:
Code:
#!/bin/bash
#ascript.sh
[code]...
View 8 Replies
View Related
Jan 12, 2011
I am not positive that this is the right subforum for this post. It is technically a programming question but I am not sure if this is the best place for bash scripting questions. Anyhow, I have been having trouble getting up in the morning. I am a pretty good morning person and once I am up, I am good to go. The problem is getting out of bed. Traditional alarms have just not cut it in the past; there is always an easy way to shut them off and go back to sleep.
Recentliesh, I decided to try to make an alarm script in bash that would be more successful in getting my lazy behind out of bed. I am a newbie bash scripter at best so my attempts have been very simple but have not cut it so far. Here are some examples:
[Code]....
The above script was the version of my bash alarm. It will not stop ringing until I input that ridiculous phrase. The big issue with this script was that I would input the phrase quickly and go back to sleep. It was however, much more successful than traditional alarm clocks. Another obvious pitfall was that even though control-c'ing the process would not work, the terminal could be closed and that would be the end of it. I'll get back to that issue. Here is my second attempt:
[Code]....
View 7 Replies
View Related
Oct 7, 2010
I am getting an error as below.
How do I resolve the error: make[2]: *** No rule to make target `', needed by `mpg123'.
How can I resolve this error.
View 4 Replies
View Related
Nov 14, 2010
I've been trying to make a bunch of graphs using gnuplot from a bash script. The tricky thing is that I have to divide values from two columns: Code: plot "results.csv" using 1:($4/$6) notitle with lp When this command is called from a bash script, the columns get mixed up with script arguments. how to make it read the column values like in the interactive mode?
View 1 Replies
View Related
Mar 17, 2011
I'm trying to make a automatic Wordpress installer script. It's autmattically defaulting to the else.
[Code]...
View 2 Replies
View Related
Jun 23, 2010
I'm planing to write a bash script that will make some web stats reports and I'm stuck on beginning because I don't know how can I read a directory content, put everything in a variable, compare the variable value with current date and go further.More specific ...
I have /var/apache/log/. Here I have access logs on date ( like access.log.24.06.2010.gz and so on ).
How can I do to automatically zgrep (in a bash script) last day .gz ??
View 3 Replies
View Related
Nov 29, 2010
I create a bash script that writes another bash file. But in the generated bash file I want to write a bash command in the file and not executing it.Here's my bash file:
Code:
#!/bin/bash
cat > ~/generateGridmix2data.sh << END
[code]...
View 6 Replies
View Related