Ubuntu :: Getting Script To Run In Cron?

Nov 4, 2010

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

[code]....

View 9 Replies


ADVERTISEMENT

Ubuntu Servers :: Cron Sending Email From Address / Change The Default Domain Name For Cron?

Apr 29, 2011

Can anyone tell me how i change the default domain name for cron?everything i cron runs it emails from and to user@com.com

this leaves me with a massive list of failed mails in postfix.i have mailto on my main crontab but i cant do it on all of them.

View 1 Replies View Related

Ubuntu Installation :: Cron's /etc/cron.daily/apt Not Upgrading?

Feb 25, 2010

It seems that cron is not upgrading my Ubuntu 8.04 LTS Server, no GUI installed. I changed /etc/crontab and watched apt running:

Code:

ps -A | grep apt

showed it for a long time,

Code:

sudo tcpdump tcp

showed communication with canonical sites,

but:

Code:

top

did not show any apt using CPU

[code].....

View 2 Replies View Related

Ubuntu :: Do Cron Updates Erase Cron Entries

Sep 19, 2010

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.

View 2 Replies View Related

Fedora :: No Output From Cron Jobs In /etc/cron.daily

Jan 29, 2011

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.)

View 3 Replies View Related

CentOS 5 :: Setup A Cron In /var/spool/cron/root

Feb 16, 2010

I have set up a cron in /var/spool/cron/root

*/15 * * * * /usr/bin/phplist.sh

I can see in /var/log/cron that it is running every 15 minutes but it has no effect. It is not doing the commands in the bash script.

If I run /usr/bin/phplist.sh right in the shell it works great.

View 3 Replies View Related

Software :: Vixie-Cron Not Running /etc/cron.d/

Feb 9, 2011

Is my vixie-cron broken? i have "0-59 * * * * root /usr/sbin/logrotate /etc/logrotate.conf" but it is not running in /etc/cron.d.

Code:

View 2 Replies View Related

Ubuntu :: How To Use Gpg + Cron

Aug 10, 2010

I have this script:

#!/bin/bash
## cifro un fichero
/usr/bin/gpg --encrypt --batch --no-tty --yes --recipient Mypubkey /home/joseba/salida.txt > /home/joseba/logcronjob.txt
#EOF

If I use the line

joseba@server$ /usr/bin/gpg --encrypt --batch --no-tty --yes --recipient Mypubkey /home/joseba/salida.txt > /home/joseba/logcronjob.txt

I dont have problems, salida.txt has encrypted

But by crontab -e (for user joseba) dont work and dont encrypt nothing If I use 'sudo crontab -e' same result, dont work

Mypubkey exists

On logcronjob.txt nothing, 0 bytes I think env its ok for the users

View 5 Replies View Related

Ubuntu :: Can't Get Cron To Work

Jan 6, 2010

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.

View 4 Replies View Related

Ubuntu :: Second Cron Job Isn't Running?

Jan 6, 2010

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

View 9 Replies View Related

Ubuntu :: Shutting Off Pc With Cron?

Jan 25, 2010

I'm trying to set up my pc to power off at 00:30 everynight. I'm using webmin's Scheduled Cron Jobs tool. I've tried (running as root):

halt
shutdown -h now

and neither have powered off the pc using webmin. Am I missing something?

View 8 Replies View Related

Ubuntu :: Run A Script In Cron?

Jul 10, 2010

How do I run a script in cron? would I do it like this:

Code:

* * * * * script.sh

View 1 Replies View Related

Ubuntu :: Cron Job Is Not Running?

Oct 25, 2010

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.

View 4 Replies View Related

Ubuntu :: Cron Job Not Working?

Oct 30, 2010

After 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]....

View 2 Replies View Related

Ubuntu :: Cron Job Running But Nothing Happens?

Nov 5, 2010

I am making a webpage which is to be automatically generated every minute. I've created a cron job in crontab like this:

Code:
0-59 * * * * /usr/bin/php /var/www/site/updatestatistics.php > /dev/null

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:

Code:
(root) CMD (/usr/bin/php /var/www/site/updatestatistics.php > /dev/null)

View 7 Replies View Related

Ubuntu Servers :: How To Use The /etc/cron.d

Mar 17, 2011

I have this symlinked into my /etc/cron.d folder:

Code:

*/5 * * * * python /srv/bidsite/manage.py send_mail
* * * * * echo `date` >> /home/bidsite/what.txt

but it does nothing. What I really want to happen is the first line. The second line is just for testing.

View 3 Replies View Related

Ubuntu :: Cron Not Running On 9.10?

Apr 3, 2011

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.

View 4 Replies View Related

Ubuntu :: Script Will Not Run From Cron - Tried Everything

Apr 21, 2011

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

View 6 Replies View Related

Ubuntu :: Cron Jobs Don't Run?

May 22, 2011

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?

View 9 Replies View Related

Ubuntu :: Setup A Cron Job To Run Every Day At 13:00?

Jun 15, 2011

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

View 2 Replies View Related

Ubuntu Servers :: Cron For Root Does Not Run

Jan 28, 2010

Cron for root does not run,it's 8.04LTS ubuntu server,however Cron runs for other users,Can anyone help?i've checked many times that i have the right syntax.

View 9 Replies View Related

Ubuntu :: Cron Job Not Running - How To Make It Run

Mar 3, 2010

I have a cron job set up to backup my ~/ directory everyday at 10:00. But the cron job is not running. here is my confile that I loaded into crontab...

Code:

#backup everyday @ 10:00 AM and 10:30 AM
00 10 * * * /home/dave/bin/backup.sh
30 10 * * * /home/dave/bin/music_backup.sh

[code]....

the *.sh are executable. I logged out and logged back in since I put the cronfile in crontab. The commands that I use in the *.sh files work fine when I run them manually.

View 9 Replies View Related

Ubuntu :: 9.10 - How To Know If Cron Running Program

Mar 25, 2010

I seem to be having a problem with cron. I have a python program that checks a specific directory for pending email scripts written in python.

Code:
#!/usr/bin/python
import os
emaildir = os.environ['HOME']+"/email/"
filelist = os.listdir(emaildir)
for pyfile in filelist:
if pyfile.find(".py") > -1:
execfile(emaildir+pyfile)

This code has been tested and works fine. The problem is that I need cron to run this code every 5 minutes but i can't tell if it is running: Here is my cron code:
5 * * * * /home/username/custom/CheckEmail.py >>/home/username/custom/email.log 2>&1

I activated the log (I think) but all i get is /var/log/cron.log and that only logs when I activate/deactivate or edit the cron file. is there anything else i need to set for this to work? I am running Ubuntu 9.10.

View 8 Replies View Related

Ubuntu :: Where The Cron Tables Are Stored

Apr 2, 2010

Where the cron tables are stored?

IE crontab -e (or -l)

and

the system one :-
sudo crontab -e (or -l)

I need to retrieve them from a system backup, don't know where to look.

View 2 Replies View Related

Ubuntu :: When Run As A Cron Job It Starts But Never Finishes?

May 2, 2010

When I run this this script in bash it works perfect. When I run as a cron job it starts but never finishes. The reason I know it starts is because a temp file is started by zip but never is completed.The funny thing I was running Linux Mint 8 and this worked fine I just switched to Ubuntu 10.04 & bang no good ..

Crontab -l Output -->
# m h dom mon dow command
18 21 * * * /home/joe/Scripts/./BU

[code]....

View 9 Replies View Related

Ubuntu :: Simple Cron Job Backup ?

May 4, 2010

i am very sorry if this has been asked before... i'm sure it has.. but i have searched all over the net looking for an answer and i still cant find it...

I have a really simple cron job script like this:

When i run this manually it works fine but when i run it from my ROOT user in Plesk as a cron task is always creates a file that is just 45 bytes. Why doesn't it work... I am running it as a root user.. so surely i must have permission to access the file?

View 7 Replies View Related

Ubuntu Security :: Where To Find This CRON Job?

Jun 4, 2010

Where to find this CRON job ?

edit....
i found it at syslog, CRON schedule check for php5:-

Quote ...

but i still don't understand , why / what schedule it to check php5 ? how to off it ?

View 3 Replies View Related

Ubuntu :: Unison Run From Cron Fails

Aug 26, 2010

I have unison set up (using the .unison/default.prf config file) to sync certain directories on my work computer with my home computer.

View 2 Replies View Related

Ubuntu :: Scp From Shell Script Using Cron

Oct 12, 2010

I have a script that I would like to run using 'cron'. I want to use 'scp' to transfer files from one machine to another. I have set up the SSH keys on both machines. When I run the script from bash terminal, it works flawlessly. But when I schedule a 'cron' job to run the same script, 'scp' does not transfer the files.

'Return value' is 0 when the script is run from bash directly. But when it runs from 'cron', the 'Return value' is 1. That means, surely, that 'scp' is throwing an error. I don't know which error is being encountered. Could anybody let me know how to make it work?

View 8 Replies View Related

Ubuntu :: Automtic Suspend Using Cron

Oct 22, 2010

It seems an easy task to suspend a computer in command line i search through the net and find this:

I want to suspend my computer at a specific time when im away from home but i have 2 problems in cron that i could not solve it yet.

1- it needs user password (how can i embed the password?)

2- it needs to press a key before suspend.( i want to suspend automatically) ubuntu 10.04.1

View 8 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved