General :: Crontab(systemwide Cron) Not Working?
Apr 26, 2011SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# m h dom mon dow user command
[code]...
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# m h dom mon dow user command
[code]...
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 RelatedI've commented out a line in the crontab on a debian server, which I guess was there by default yet was causing me to get error emails every hour:
# m h dom mon dow user command
17 * * * * root cd / && run-parts --report /etc/cron.hourly
However, the error emails keep coming in as if it hasn't been commented out. The error emails:
Subject: Cron <root@(none)> root cd / && run-parts --report /etc/cron.hourly (failed)
/bin/sh: root: not found
I am trying to have the files from /user/directory copy every hour to /backup/user/directory. It would seem that cron or crontab is what I need to use. Looking at previous posts and other documentation only shows how much I don't know. When I type crontab -e I get a blank file I can type into, seemingly using vi as the editor. I have no problem with that but when I type cron -l, I get my text after a message about "Do Not Edit this File". What I am reading just makes no sense, I am not understanding even the most fundamental aspects of cron or crontab. Where I can get the most basic of basic instructions to try to understand this function?
View 4 Replies View RelatedI am trying to setup a cron job using crontab entry like this 6,16,26,36,46,56 * * * * /usr/bin/fetchmail -k>/dev/null 2>&1 But nothing is happening This is the first time I have attempted using cron as I have settup mutt for my email which is now working great but I would like to have the mail collected every 10 mins The file is saved as mailcron in my /home folder. When i run crontab -l its listed ok but no mail is appearing in mutt.
View 10 Replies View RelatedI am trying to run rsnapshot from cron via root's crontab file (crontab -e). If I run rsnapshot from the command line with sudo it works perfectly, however, if I run it from cron:
Code:
* * * * * /usr/bin/rsnapshot hourly >/tmp/crontab.out 2>/tmp/crontab.err
This does not work. The crontab.err file shows:
[Code]....
I'm running Ubuntu server 8.04.3 with eBox on a Dell GX280. I want to power off my box automatically every night, so as root I added a crontab entry "05 1 * * * /sbin/shutdown -P now". The command runs on schedule but most days the PC goes into a coma instead of powering off. It doesn't respond to key presses or mouse movement or Ctrl-Alt-Delete, I have to push its power button to complete the shutdown. I have tried a variety of alternatives such as "/sbin/shutdown -h" and "runlevel 0", they all behave the same way
View 14 Replies View Relatedis 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 Relatedif I run mysqldump from crontab and error occurs, I would like to have email send to me (reporting that backup is not working).
View 2 Replies View RelatedI run a Fedora 9 server at home, to host an "old school" MOO.To back up the database, I scheduled a cron job - and got some help with the script.I don't fiddle with stuff on the server much, because I don't really have a clue - leave well enough alone.But now I'm without backups. (I'd prefer to get this working, as it seemed pretty simple, and worked well for so long).
View 14 Replies View RelatedIt is little weird now that cron job is not working as i have set. I have set weekly job to send email but i am receiving multiple emails daily. Below is my code; # sends email every monday at 4:00 am 00 04 * * 1 /usr/bin/ruby /home/mbm/www/current/script/runner /home/mbm/www/current/app/models/add_to_delayed_job.rb -e production
00 -> Minutes
04 -> Hours (0-24)
1 -> Days / 0-6 / Sun - Sat
Sending email is fine but the time is not working so far as set.
I make a script to automate burning backup files on dvd. It works fine if I start it from root user, but if I start it. From cronjob do noting. I try on growisofs the option -use-the-force-luke=force but nothing happens. I check the env of cron:
HOME=/root
LOGNAME=root
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
PWD=/root
SHELL=/bin/bash
SHLVL=1
XDG_SESSION_COOKIE=3e0d70f7b71074a0b1fff4bb4aa97d13-1281297181.926502-724038309
_=/usr/bin/env
and it seems ok i've got my script in /usr/local/bin and growisofs in /usr/bin
Code of my script below:
#!/bin/bash
bkup_path='/bkrepo/';
prefix='PAR*';
totdimfile=0
for FILE in $(/bin/ls -r $bkup_path$prefix)
do
dimfile=`/bin/ls -l $FILE | /usr/bin/awk -F " " '{print $5}' `
let "totdimfile += dimfile";
if [ "$totdimfile" -lt "4700000000" ]
then
NAMEFILE=`/bin/ls -l $FILE | /usr/bin/awk -F " " '{print $8}' `
ALLNAMEFILE="$ALLNAMEFILE $NAMEFILE";
fi
done
/usr/bin/growisofs -use-the-force-luke=force -Z /dev/scd0 -R -J $ALLNAMEFILE
/usr/bin/growisofs -M /dev/scd0=/dev/zero
/usr/bin/eject
end code of my script
How to schedule a job using cron that shouldn't run between working hrs 9am-5pm, while run in non working hrs every hour, every day of the month, month & week.I tried the following way, not sure I can use logical not operator(!).
View 3 Replies View RelatedGot a small problem, I'm trying to schedule a script to run every Thursday at midday and the scheduled tasks application on Ubuntu doesn't seem to work. The script is fine when I run it from a terminal.I have zero experience using cron at the command line, can anyone tell me what I should do?
View 2 Replies View RelatedI am new to Linux and have done an install of Moodle 1.9.8 on Linux OpenSuse 11.0
I have created my cron via the terminal (crontab -e) root crontab - see below:
When going to /var/log/messages my cron entries appear as they should but my backup does not run and every morning when I go to the Notifications tab it tells me my crom maintenance script has not run in 24hours.
I would also like to get this in a log file and emailed to me.
The back.sh script is being run as user basil, whcih means that when it comes to copying the backup file to the target location you do not have the correct permissions to access the contents of the directory (it is rwx by root only).So, what do we do? Hoping it is ONLY the directory permissions which are fouling things up we have a range of options which, in not particular order of 'good', include:
a) change ownership/permission on target directory.
b) have the back.sh script run by the root user
c) set up sudo to permit the file copy to be done by root
d) use setuid on the back.sh to have it run, effectively, as root
A lot of the answer will depend upon what else the Dropbox directory is for. If it's JUST for your backups for this then I'd be inclined to:
Code:
chown basil /root/Dropbox
chmod g+rwx /root/Dropbox
which will permit the basil user full access and thus allow the file operations being done and give root access via the group permissions (not that the root user really needs this).Also, I'd be inclined to:
Code:
chown basil /home/xxxx/moo3/bin/back.sh
chmod u=rwx,g=rx,o= /home/xxxx/moo3/bin/back.sh
which will make things 'look' better, it just reinforces the point that the script is run (and owned) by the basil user.
I have two servers. One of them has a svn server running and another hosting projects.
I have a daily cronjob updating the projects -- ie running svn update, rebuild etc.
Now, my cronjob on the remote server works.
However, a similar cronjob running on the local server for local projects (ie the same server as svn) is instead displaying a "svn: not working copy".
I double checked the paths, permissions and user info and if the script is launched manually, it works fine.
Deploying the same thing remotely works.
I even tried using file:/// (suggested here http://www.hightekhosting.com.au/myaccount/knowledgebase/90/Using-SubversionorSVN-on-cPanel-Servers.html) but still nothing.
I'm building myself a light htpc with Ubuntu 10.10 Server without Gnome, but with XBMC and I'd like the ability to stream sound from my other computers to the htpc which is connected to the soundsystem.
But I can't get it to work. Alsa (before I started with Pulseaudio) played the sound from Xbmc. After that I installed pulseaudio, removed my user from the audio-group and added myself to the pulse-access-group. I also tried to set the default alsa-device to pulse (see attached .asoundrc at the bottom) since the default setup didn't work for me. When I try to play a sound file, I get this error message.
[Code]...
No matter what I try I just cant get cron working for me on my Squeeze setup I can type /usr/bin/soffice and openoffice will fire up no problem but put into a crontab and nothing for instance just to test if crontab is working I have this/5 * * * * /usr/bin/sofficeIn y user crontab but nothing happens I have run as root crontab -u djt crontab And after editing the crontab with crontab -e it says it is installing crontab but it just does nothing Unfortunately I am connected to my works network so unable to receive internal mail from cron so cant find any reason for it not working
View 4 Replies View RelatedHave just started to use look at crontab. I could use Scheduled Tasks as well as crontab -e in terminal.
I must have changed something because now Scheduled Tasks just seems to load then dropout. Loading a task through terminal is accepten (crontab -e) but doesn't work.
I'm setting up a new server and have edited the crontab to a run a script but nothing is happening, is there anything I need to setup to get the crontab working?
View 6 Replies View RelatedWhat is the difference between the crontab located in /etc/crontab and the crontab that can be edited using crontab -e?
View 2 Replies View RelatedAfter I create a cron job to shred some documents it seems to start and then immediately stop. What am I doing wrong? For instance, here is my cron:
#!/bin/sh
DISPLAY=:0.0
PATH = /usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin:
[code]....
I have a cron job to run every 15 minutes. The cron job is running per /var/log/cron. It lists the job every 15 minutes.
[Code]...
I do not see any errors. I also looked in /var/log/messages for any errors and it does not list any. I added a line to the script that is running to send an email to me to see if it is running or not. When I run the script from the command line, the script runs without error and I get an email. I have searched and can not find what it going on. Is there some where else errors might be? Could there be a permission issue? The cron job is not being added by the root user.
I set up a job in my crontab file to clear the /tmp file on bootup with the following line:
Code:
@reboot rm-rf /tmp/*
My /tmp folder is not clearing. I've never used cron before;
I have a ts3.desktop file in my /usr/share/applications folder that I want to run on system boot. I have typed the following commands which don't work
Code: Select allcrontab -e
Then in the editor, I typed the following line at the bottom of file. I also made the necessary carriage return after this line.
Code: Select all@reboot gtk-launch ts3 /usr/share/applications
Then I pressed ctrl+o to save it.
After I put these commands in, I did the following command to troubleshooting this issue, see below.
Code: Select all$ crontab -l
no crontab for server
$ps -ef | grep cron | grep -v grep
root 532 1 0 21:35 ? 00:00:00 /usr/sbin/cron -f
But after I reboot and nothing happens, the application doesn't start.
I'm trying to remotely schedule a shutdown using cron but I can't get it to work. I did setup the following 'sudo crontab -e'
Code:
For some reason doesn't this work, since I was able to login and get this output when using 'date'
Code:
I'm running cygwin 1.7 on a vanilla win2k3 r2 server. I've put together a simple crontab that I'll paste in her in a sec. The crontab entries call several shell scripts that do either scp's or rsync's from linux servers to this win2k3 box under cygwin.
The problem is that the scripts work and run fine from the commandline. Just not when called from the crontab. I'm running from the root equivalent administrator UID. The crontab log files are empty of errors.
crontab is:
Like I said, the scripts execute fine from the command line.
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)
I'm creating a script all worked fine in the command line. But not work in the cron. Below you could see the script
[Code]...
So far I found when I use corn following part not working, nothing goes to the processedfiles file. ls -l /var/lct/mou2/processed | grep $TODAY | awk '{print " " $8}' > /home/trans/mou/processedfiles ls -l /var/lct/mou2/processed | grep $YESTERDAY | awk '{print " " $8}' >> /home/trans/mou/processedfiles This work perfect in command line. Corn job and command line use by the same user.