I've been trying to accomplish this on my own, but I can't seem to figure it out...
All I'm trying to do (for learning purposes) is to get a message to print out to a log file every 5 minutes.
This is on Ubuntu Server 6.06.
Logged in as root ( I know, I know, should have sudo'd, oh well... )
Created a new file with this in it:
Code:
Added this line:
Code:
( I wasn't sure the proper command to try every 5 minutes, but this is my latest iteration. I also started with just */5, and that didn't seem to work either. )
Saved and exited crontab.
Console reports:
Quote:
Using command: ps -ef | grep cron
Quote:
So I waited 10 minutes to be safe.... and saw no log file appear.
I checked this page here: [url]
I wasn't sure what it meant by the PATH= variable they wanted me to set, my /etc/crontab file states:
Code:
But I didn't know if it meant there, or in my crontab -e location, so after the first failed attempt, I added the line from that webpage as well to crontab -e:
Code:
Waited another 10 minutes to be safe, still nothing.
I want cron to act as an alarm clock: first, it plays an mp3 file and then it runs the speech synthesizer festival which tells me to get up and do stuff.
Now, mp3blaster doesn't do anything when I run it from cron, but festival works without problems.
I've found some possible causes for mp3blaster not working through cron. Someone suggested that pulseaudio is not started. This shouldn't be the problem for me, since I don't even have pulseaudio installed, and festival is playing sound without problems...
I don't know what I should do to make it work.
Here is my script - runalarm.sh:
Code:
I don't want to include the wakeup text here since it contains profanity.
The mp3 player could be another one too. mp3blaster happens to be the only player I know that is easy to run from console, like this "mp3blaster goodsong.mp3", without and playlist creation or other stuff like that.
I can run the runalarm.sh from SSH console and it works fine, the mp3 starts playing and festival speaks after that. When run from cron, festival starts speaking right away and no mp3 is heard.
I have a backup sh file that I have been using for a long time. It has always worked. 2 Days back I switched to a different pc and now suddenly the script don't work.If I run it manually in the terminal it works. But when it execute with cron it doesn't copy any files to the backup destination. It starts but doesn't copy anything.Can someone help me as to why it works manually but not with cron ?
I can't seem to get a cron job to work on my Fedora 11 box. When I check the logs, cron is actually working. In my /etc/crontab I have an entry to run the cron job on my Moodle installation:
I have a simple cron job that runs every night & I tested this manually by just running the command as root in bash and all worked fine. It took some time but the crob job finished and I got my results emailed to me perfect / as expected.
Here is root's cron job listing:
Code:
Now I noticed that I never ever got anything emailed to me the following day so I am wondering if perhaps the Cron daemon doesn't have permissions or has an issue running / executing the command rather than when I test the command as 'root'? When I view my logs, I can see the command being executed and don't see any errors however I don't get email results when Cron runs the job rather than me taking the command and running it manually in Bash...then it works. What am I missing?
Cron refuses to work when trying to sync with a network drive. I am trying to setup a cron job to backup a folder in my home directory ('/home/scratch') to a folder ('home/internet_backup') that is mounted (using nfs) to a network folder. The folder ('home/internet_backup') is mounted correctly to the network folder upon system startup, so this part works.
I created a simple bash file (rsync-shell.1.sh) that looks like this: Code: # backup the contents of 'scratch' (of 'internet' machine) into '/home/aa/internet_backup/' # the latter folder ('/home/aa/internet_backup/') is mounted to 'developer' machine rsync -av --exclude=".*" /home/aa/scratch /home/aa/internet_backup/ #
When manually running this bash file from my home directory (./rsync-shell.1.sh) everything works, and the contents are written to the destination folder. Yet, instead of running this manually, I wanted this to be executed by Cron every 30 min. so I first chmod +x this file, and then copied it (using sudo) to /root.
I then created the following using 'sudo crontab -e': Code: # m h dom mon dow command 10 * * * * /root/rsync-shell.1.sh This is the same bash file illustrated above, yet, it doesn't work (files are not being written to the destination folder).
I created a very simple cron job for testing my first Linux system but It doesn't work. After open the crobtab file by typing crontab -e, I put a line like this to send email in every 2 minutes to report disk usage:MAILTO=dan@gmail.com*/2 * * * * du -s /homeI tried to restart cron several times but I still got nothing worked. /etc/init.d/crond restart
I am having some trouble setting up a cron job that creates a tunnel to my remote machine to work correctly on Ubuntu 9.10. The setup looks like the following:
(1) myscript.sh (executable) Code: #!/bin/bash ssh -2 -x -i /home/user/.ssh/id_rsa.prv -L 3128:myremotemachine:3128 myaccount@myremotemachine (2) crontab -e, added the following lines:
I have installed CPAN module Spreadsheet::WriteExcel, to generate some reports. Now when i execute my perl module from command line. it works fine and generates the excel file. When i put this module to be executed via cron, it doenst work and an email is generated. My entry in cron tab is as follows:2 14 * * * perl /scripts/postpaidRecon/postpaid.plThe email i receive in /var/spool/mail/root for module failure is:
I put in my cron entries to run my backup script which rsyncs my data to my 2nd drive, however on a hunch I checked my backup drive which mounts automatically via fstab and I realize it had not ran in a while. I checked cron and there were no entries for it. I got to wondering if I should ever be worried about a cron update coming down and over-writing my existing cron file with the backup entries in it to run.
I have added some executable scripts to /etc/cron.daily but don't get the stdout/stderr output from them as mail (or anywhere else I have found). At least one of them is running (because I can see that it has added a file to the disk).
The peculiar thing is that I do get the output from /etc/cron.daily/0logwatch (part of the logwatch package) as an email each day.
The MAILTO line in /etc/crontab is "MAILTO=root" (unchanged from default). Same for /etc/anacrontab.
I do have an alias at the end of /etc/aliases which redirects root's mail to my own account, but this alias works fine for mail I send manually. (It also appears to work fine for the output from the file /etc/cron.daily/0logwatch.)
why my second cron job isn't running? The first one runs fine but the second one does not run at all. If I manually run the script using ./check.sh then it does what it is supposed to but will not run from cron. It should run every weekday at 9:45am, it looks good to me but clearly I am doing something wrong.
Code: # m h dom mon dow command #This will backup my hosted websites. 0 2 * * * /home/bob/scripts/websitebakscript.sh #This will run check and upload it's contents to the net. 45 9 * * 1,2,3,4,5 /home/bob/scripts/check.sh
Cron refuses to work for a newbie.I am trying to setup a cron job to backup a folder in my home directory ('/home/scratch') to a folder ('home/internet_backup') that is mounted (using nfs) to a network folder.the folder ('home/internet_backup') is mounted correctly to the network folder upon system startup, so this part works.
I have a working bash script to do backup - it runs fine from the terminal. During the backup it makes a log file in my home area. I transferred it to root, and set it up to run as a cron job as root. It runs fine as long as I am logged in with my normal user name. It does not run if I am not logged in. Logs show the script was called by cron, but there is no output and no backing up is done.
Here is the script
Code:
#!/bin/bash for i in `cat /proc/mounts | cut -d' ' -f2`; do if [ "$i" = "/media/Elrond" ]; then
When I refresh the page 'updatestatistics.php' in my webbrowser it does generate a new page ('statistics.html', which is included in 'statistics.php'). But when I let this cron job do the job, nothing happens. I looked into the log file, it shows this:
After saving a few sample scripts in crontab, I discovered that cron is not running properly on my Ubuntu 9.10 (32 bit), after a recent reinstallation. Please note that the files "/var/log/cron" and "/etc/defaults/rc.conf" are empty in my system.
I'm trying to get this script, which normally works fine, to run from cron. This is far from my first custom cron script, but it's the first to give trouble! I've added PATH directives (never had to do that before) but it still didn't work. I also tried setting absolute paths, that didn't help either. If I add a line that echoes a string to a file as a test at the end of the script, the file appears, so I know the script is executing, it just looks like the cpufreq-set commands aren't working. The purpose of this script is to adjust the maximum SpeedStep setting on my now passively-cooled home server to keep the CPU from getting too toasty.
Code: #! /bin/sh PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin # set temp above which to drop the maximum frequency scaledowntemp=`echo -n "62"` # set temp below which to reset the maximum frequency scaleuptemp=`echo -n "59"` # get cpu temperature cputemp=`sensors | grep "Core 0" | gawk '{print $3 }' | sed -e 's/+//g' | sed 's/....$//'` if [ $cputemp -lt $scaleuptemp ] # if temp is in acceptable range, set max frequencies free then cpufreq-set -c 0 -u 2.81Ghz cpufreq-set -c 1 -u 2.81Ghz fi if [ $cputemp -gt $scaledowntemp ] # if temp is too high, limit cores to 1.6Ghz then cpufreq-set -c 0 -u 1.61Ghz cpufreq-set -c 1 -u 1.61Ghz fi
I have this in my crontab (along with another line before it):
Code: * * * * * /bin/echo "Does this work?" > ~/test ...and the file doesn't show up. I have a blank line after that one in the crontab. I have no /etc/cron.allow or /etc/cron.deny files. I'm running Ubuntu 11.04. /var/log/syslog shows "BEGIN EDIT" and "END EDIT" etc. when I run crontab -e, but doesn't say anything about trying to run commands. Anything I might be missing?
I've setup a cron job to run every day at 13:00. When I run it manually it works but with the cron it doesn't
this is the log:
Code: Jun 14 13:00:01 testserver CRON[5662]: (scialom) CMD (lynx http://www.something.com/sms_reminder.php # JOB_ID_4) Jun 14 13:00:02 testserver CRON[5661]: (CRON) info (No MTA installed, discarding output) Jun 14 13:00:08 testserver dhclient: DHCPREQUEST of 10.0.0.6 on eth0 to 10.0.0.138 port 67 Jun 14 13:01:14 testserver dhclient: last message repeated 4 times