General :: Breaking Long Command Into Lines In Crontab
Oct 14, 2010
How to break strings of command into multi-lines in crontab? e.g.
Code:
# the following is a very long a gruesome command to be run at 09:59 Monday to Friday.
59 09 * * 1-5 source $HOME/some-definitions; sh /usr/local/my/long/name/application/bin/hello $(date +\%Y\%m\%d) >>/var/log/my/long/name/application/log/hello.log
View 2 Replies
ADVERTISEMENT
Sep 20, 2010
Silly question here. My crontab looks like this:
Quote:
0 22 * * * /usr/sbin/logrotate /var/log/VRTSralus/VRTSralus.logrotate
#0-59/10 * * * * /root/memmon.sh >> /var/log/memmon.txt
0 8 * * 1 /root/SHC.sh
#0 21 * * * /root/scripts/ralus_restart.sh > /dev/null 2>&1
As you can see two of the lines are commented out. However, both commented out commands are still running. I get emails stating that the RALUS agent restarted (another mystery since it's supposed to go to dev null according to the line above), and I can see that the memmon script is also running daily. Am I missing a step? Some other place I should be looking? Commenting out lines in your crontab is pretty much a no-brainer, so I appear to have less than no brain as this is a mystery to me.
View 5 Replies
View Related
May 23, 2011
I use crontab to execute a bash script every minute and the output is redirected to a log file.In that bash script there is a screen command to start a screen session.When I execute the script manually it works perfect, but with crontab, the screen command is not executed, but the echo's are. Because they are written in the log file...Here's my script:Script removed for violation of LQ Ruleso the script runs perfect when I do it manually, but not with cron...Here's my crontab (sudo crontab -e)
# m h dom mon dow command
*/1 * * * * sudo /home/laurent/Games/Cod4/StartCod4.sh | egrep 'running|started' >> /home/laurent/Games/Cod4/Serverlog.log
View 7 Replies
View Related
Apr 27, 2010
I am using Linux 64 bit Redhat Linux. I am trying to setup simple crontab as follow...1. Edited crontab file using crontab -e2. Listed the file once to verify it using crontab -l. This will display as.. 18 5 * * 2-3 ksh $HOME/testScript.sh > $HOME/testscript.out3. Logged in a root and restarted cron deamon using "/etc/init.d/crond restart"As per my understanding now my testScript should start running at 5:18 am Thuesday
View 3 Replies
View Related
Aug 26, 2010
I have a question about using crontab with /etc/crontab...
I had a cron job that I needed to run as root. At the time I thought that sticking it in /etc/crontab would be a good idea. However, I used the crontab command to edit /etc/crontab, which I guess is not standard procedure? Specifically, I configured /etc/crontab as my local user's crontab (i.e. sudo crontab /etc/crontab) then added my cron job as I would a local user crontab (i.e. sudo crontab -e).
Originally, my cron job looked like this:
30 * * * * root /my/batch/script &> /dev/null
After adding the new cron job I started seeing errors. Something to the effect of "can't find command root" or something similar. So I removed the 'root' user definition from the cron job and the job started running fine. However, because this is /etc/crontab, there are other system related cron jobs that have been defined to run under the root account (e.g. "17 * * * * root cd / && run-parts --report /etc/cron.hourly" runs as root, etc.). So these pre-existing system cron jobs, which up until now have been running smoothly, are now generating "can't find command root" errors. But I think that the system cron jobs _are_ successfully being run someplace because logrotate seems to be working.
So what I _think_ is happening is that /etc/crontab is being run twice: once as the system crontab, and once as my sudoed local user's crontab. When I run crontab -l I see nothing, but when I run sudo crontab -l I can see the contents of /etc/crontab. I am reluctant to delete my sudoed local user's crontab, because then in the process I would be deleting the system crontab, and I do not know how I should restore the system crontab's contents. (I am still not sure as to the most appropriate way to edit the system crontab).
How can I get out of this mess? I want /etc/crontab to go back to the way it was before--running _once_ as the system crontab. As for my new cron job, I'm willing to reconfigure it anywhere so long as I am still able to run it as root. Any ideas? (I am using Ubuntu 8.04 Server LTE)
View 2 Replies
View Related
May 25, 2010
I have a CDL netlist with 5630 lines. 512 of the lines are over 128 characters. The tool I am using to read in the CDL returns an error for each line over 128 characters.
If the line is too long I can fix it by adding a line continuation symbol, in this case a "/", somewhere prior to the 128th character then a line feed, obviously, and a "+" to the continuation.
example (pretend its a long line);
before;
this line is too long
after;
this line /
+ is too long
Part of the problem is that I can't use a constant point prior to the 128th character because I can't break up a term.
bad;
this line i /
+ s too long
If I can replace the last space before the 128th character with " / + " on all lines that are over 128 characters then I'm golden. I'm not sure if I need to escape the + or not. If so then the substitution is " / + ". And if I use sed then I'll escape the .
View 6 Replies
View Related
May 17, 2011
I write a little script that run top command and clear the output leaving only cpu ram and swap values. If i run the script manually everityng works fine but when i schedule the cript to run every 5 minutes from /etc/crontab all run fine but the output of the top command doesnt appear in the log :
This is the cript :
#!/bin/sh
echo "#############################" >> /var/log/performance.log
echo "" >> /var/log/performance.log
/bin/date >> /var/log/performance.log
[code]...
View 6 Replies
View Related
Jun 15, 2010
I am scheduling a command for a specific time every day.
Linux crontab format which I am using :- MIN HOUR DOM MON DOW CMD
30 08 10 06 * /home/mach/script.sh
Some presetting is required?
View 13 Replies
View Related
Jun 29, 2011
Slackware 13.37, tested on 2 different PC;
affected: mousepad and tcl/tk applications
I am using mousepad and tcl/tk application to view text files with long lines. Sometimes ago I found that some characters (part of line) in long lines disappear. The problem is shown on a very small video. [URL]
View 14 Replies
View Related
Nov 18, 2010
I have install RHEL5 and created normal user as "test". When I login as root user, I can run crontab command but when I login as test user, I can't run crontab command and throws error as "cron/test: Permission denied". how to enable crontab command for test user as well?
View 3 Replies
View Related
Aug 11, 2011
The find command is taking too long on my machine to complete. When I use time command, I find that sys time and user time are too small as compared to real time. Is my find process not getting scheduled properly?
I interrupted the neverending find command and got the following statistics:
Real time : 5min
Sys time : 1.1 sec
User time : 3 sec
I was running
find / -name ls 2>/dev/null
View 2 Replies
View Related
Jun 23, 2011
is it possible disabling a crontab job without deleting the crontab description entry (by crontab -e)?I could also accept to change the entry itself. Now it's:0 0 * * 0-6 /home/me/cron/script.csh
View 4 Replies
View Related
Mar 22, 2011
i have a text file generated automatically from a script , but the result in the script is not ordered in a readable way, so i need your help to fix it using a shell command the text file contain data in this way :
Code:
0.147361 0.243688 0.081520 -0.446603 1.130529 NC_000846 Chordata
Rheiformes
Aves
0.091740 0.379224 0.021160 -0.088493 3.441356 NC_000857 Arthropoda
Diptera
[code]....
i want to arrange the data in this text file in a way that each line will concatenate the 2 lines after it , so that will be 1 line , i want all the lines to be treated in this way ,
View 2 Replies
View Related
Feb 22, 2011
I've seen a few tutorials that have commands and parameters on multiple line, like the one below:
Code:
chkconfig --levels 235 mysqld on
/etc/init.d/mysqld start
I can copy and paste this in Putty, but what if I want to manually type it? If I press return, the first line gets processed, so how do I insert a new line?
View 4 Replies
View Related
May 28, 2010
I'm looking for a command to swap the even/odd numbered lines in a file. Example input file:
Code:
1
2
3
4
[code]...
Example output file:
Code:
2
1
4
3
[code]....
I'm sure there's a way to do it with sed, awk, grep and the like but it's been many years since I've used these commands on a daily basis and I can't seem to figure out the correct syntax.
View 2 Replies
View Related
Jan 20, 2010
How to check the version of a program, in particular geant4, in linux using the command lines?
View 4 Replies
View Related
Jun 21, 2011
I would like to know the command lines for;
-detecting the wifi in my house without being connected to it
-getting ips/macaddress from the people connected to the wifi
View 2 Replies
View Related
Jun 23, 2009
I have to trace back what command and when it is used for the last 3 months. It is quite urgent as I have trouble with the system configuration.
View 5 Replies
View Related
Jun 4, 2011
I wrote a simple script to see if firefox is running. However, the ps command is not executed, when I open the logfile I see: "DEBUG LINE 4" and not DEBUG LINE 5, so "ps -e" is never executed despite using the full path of the ps command.
Here is my script:
#!/bin/bash -l
# simple script to test if firefox is running...
PS=/usr/bin/ps echo "DEBUG $LINENO"
$PS -e | fgrep firefox echo "DEBUG LINE $LINENO"
View 6 Replies
View Related
Feb 3, 2011
I tried scheduling a task using crontab -e and added the line:
Code:
58 23 3 2 4 /usr/bin/freshclam --verbose --log=/home/EXISTING DIR where I have permissions
The timing was simply a test run. My syslog gives the following error:
Code:
(CRON) error (grandchild #4309 failed with exit status 62).
I also tried to add to root crontab as below, but got the same error.
Code:
sudo crontab -u root -e a
View 9 Replies
View Related
Jan 13, 2010
For some reason crontab does not work on my system.
Fedora Core 11
I am running from a Virtual Private Server.
Code:
Code:
View 2 Replies
View Related
Feb 19, 2011
Having an odd problem running a mysqldump via crontab. I have the script running on other servers and they work fine, so not sure how to actually troubleshoot, but the script looks like the following;
If I run it as a cronjob as root, it finishes in a second and a 20k file is there. If I run it from the command line as root it does the backup (takes a few minutes) but does complete the backup and can be unzipped and read successfully.
View 3 Replies
View Related
Jun 14, 2011
Take this block of pseudocode:
Code:
for i in $list; do
<some statements>
if i > 5
exit
<more statements>
done
That is, want to terminate the iteration just after 5 iterations. A first problem, is that list is a string and not a number. It's all I can say, except to keep reading bash monster manual.
View 8 Replies
View Related
Jan 26, 2010
I've come across an unusual requirement for a service in my Ubuntu system.Simply put, I need to find a way to search for all instances of a term in a file, delete lines containing containing that term, and delete four lines below each instance of that term. ither that, or copy the entirety of a file to a new file and skip over all lines containing the term plus four below it.This sounds kinda weird, I know. Without going too far into detail, I either have to change the logfile format for a server I'm running which is a huge pain in the butt, or I can just run a script to edit an HTML report generated from said logs. (Said report is really just for managers to peruse, and I like my log format, so I'm pursuing option 2.)
View 4 Replies
View Related
Jan 27, 2010
I created a file which in I tried both :
Code:
MAILTO=""
* * * * * /var/www/scripts/script.php >> /dev/null
[code]....
View 5 Replies
View Related
Aug 9, 2010
I misused wildcards like a moron, in the rename command. I repeated names twice in a 3gig folder, which I cannot afford to delete. Now, the rename command is not working, and it says the file name is too long. I am a competent programmer in Java, PHP, and I know basic C.
View 7 Replies
View Related
Jul 23, 2010
Is there a command which can be used to run some other command on a few lines from a file or an o/p of some file. (the kind of role that -exec option does for the find command). (I have solved the purpose using a bash loop but would like to know if there exists a command).
View 4 Replies
View Related
May 29, 2011
What is the difference between the crontab located in /etc/crontab and the crontab that can be edited using crontab -e?
View 2 Replies
View Related
Sep 11, 2010
how i run the following lines onboot
code:....
/media$ sudo mount /dev/sdb1 /media/mediaStorage1
/media$ sudo mount /dev/sdc1 /media/mediaStorage2
View 5 Replies
View Related
Jan 9, 2010
just start Ubuntu 9.04 said: File system chek failed a long is beging saved /var/long/fsck/checkfs if that location is writable Please repair the file systmen manually A maintenance shell will now be started Ctr+ D terminate this shell and resume system boot. Give root password for maintenance or type Control +D to continue. I did Ctr+D , and after login said , that can not find /home. I starte with the live cd:
[Code]....
View 9 Replies
View Related