11-29-2006
Where does cron run from?
I have a script in the same directory as some files and directories im trying to tar up and I have it run in cron. Well it runs but says it can't find the directories, you need to be in the directory where the script is for it to work. Here is my cron and script its crappy but it does the trick =). Is there anyway in cron or my script to get this script to run correctly?
0,5,10,15,20,25,30,35,40,45,50,55 * * * * tmp/daily_backups/daily_backup.pl
$dirtocopy = '/tmp/daily_backups/';
$backupfile = 'backup.tar';
print "Tar'n up directories... \n";
print `tar -cf backup.tar Baro Nitro Turbo`;
print "Done Tar'n directories... \n";
print "Backing up $dirtocopy$backupfile \n";
print `ls | grep backup.tar | cpio -ocB > /dev/rmt/0`;
print "Backup is now complete... \n";
print "Rewinding tape... \n";
print `mt -f /dev/rmt/0 rewind`;
print "Tape rewound...";
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
Hi,
Does anyone know why the cron job fail to run automatically ?
We have the problem with some Solaris 2.5.1 Machine !
The cron seemd to fail to submit the jobs defined at the defined time !!
Why ?
Sometime it runs OK,but sometime it fail .
We are very sure the problem is due to... (6 Replies)
Discussion started by: kerwin_hsu
6 Replies
2. Shell Programming and Scripting
test.ksh
===================
#!/usr/bin/ksh
APPLICATION=hr_app
APPLICATION_UPPER=`echo $APPLICATION | tr `
echo $APPLICATION_UPPER > /tmp/test.txt
echo $APPLICATION >> /tmp/test.txt
which tr >> /tmp/test.txt
===================
When I run this from the shell:
/home/natter> more... (6 Replies)
Discussion started by: natter
6 Replies
3. Linux
hi,
I am newbie,
I had set cron jobs to update something on one time very day,
I had tested the script, it run fine,
but the cron jobs seem never run.
some help?
Thanks. (4 Replies)
Discussion started by: robertsnoog
4 Replies
4. Shell Programming and Scripting
I have a perl script, when I ran manually it works perfect. I check the permissions which are fine.
How can I find out why it is not running? how can I setup a log to check.
I am running it on solaris 9.
It compares multiple files, SCP and then send out an e-mail.
As I said when I ran it... (2 Replies)
Discussion started by: amir07
2 Replies
5. UNIX for Dummies Questions & Answers
Hi everyone, I am having a problem with a cron, I am using Solaris 10 and need to run a php file every 5 minutes. I can run the file from the test user, but the cron does not seem to run. I do not see anything about it in /var/cron/log but see crons for other users running. What should I look... (10 Replies)
Discussion started by: atomicbits
10 Replies
6. Shell Programming and Scripting
Dear Experts,
I have a script defined in Cron which runs every 1 minute.
* * * * * /export/home/myscript.sh >/dev/null 2>&1
Now the issue is executing that myscript.sh sometime will take 2/3 or more minutes to finish execution.
But after 1 minute cron will invoke another... (4 Replies)
Discussion started by: thepurple
4 Replies
7. UNIX for Dummies Questions & Answers
How can I run the following command from cron?
tar -cvf /email_backup/email_bu_062110.tar /prod/email (2 Replies)
Discussion started by: nim73
2 Replies
8. Shell Programming and Scripting
Hi,
Can anyone help in editing CRON (OR) write a script to run another script every second saturday??
I tried to make use of DATE command to find the day but couldnt proceed further.
your help is highly appreciated!
Thanks,
Mahi (11 Replies)
Discussion started by: mahi_mayu069
11 Replies
9. Shell Programming and Scripting
If I run 'who -u' interactively or from a script invoked through bash in a tty on my Ubuntu 12LTS box I get an output like this:
testuser pts/0 Dec 9 02:32 . 2163 (host.xx.yy)
running the same through cron I get:
testuser pts/0 2012-12-09 02:32 00:05 2163... (2 Replies)
Discussion started by: latimer
2 Replies
10. Shell Programming and Scripting
Hi,
1)
If some job supposed to run on 1st of every month at 7 AM
In cron job when we have a blackout on the 1st ( i.e when 1st falls on a sunday ) how can we make the job run the next business day?
2) How can we run a job on 25th of every quarter 7 AM(jan,apr,jul,oct)
And if 25th... (5 Replies)
Discussion started by: System Admin 77
5 Replies
CRON(8) System Manager's Manual CRON(8)
NAME
cron - clock daemon
SYNOPSIS
auth/cron [-c]
DESCRIPTION
Cron executes commands at specified dates and times according to instructions in the files /cron/user/cron. It runs only on an authentica-
tion server. Option -c causes cron to create /cron/user and /cron/user/cron for the current user; it can be run from any Plan 9 machine.
Blank lines and lines beginning with # in these files are ignored. Entries are lines with fields
minute hour day month weekday host command
Command is a string, which may contain spaces, that is passed to an rc(1) running on host for execution. The first five fields are integer
patterns for
minute 0-59
hour 0-23
day of month 1-31
month of year 1-12
day of week 0-6; 0=Sunday
The syntax for these patterns is
time : '*'
| range
range : number
| number '-' number
| range ',' range
Each number must be in the appropriate range. Hyphens specify inclusive ranges of valid times; commas specify lists of valid time ranges.
To run the job, cron calls host and authenticates remote execution, equivalent to running rx host command (see con(1)). The user's profile
is run with $service set to rx.
Cron is not a reliable service. It skips commands if it cannot reach host within two minutes, or if the cron daemon is not running at the
appropriate time.
EXAMPLES
Here is the job that mails system news.
% cat /cron/upas/cron
# send system news
15 8-17, 21 *** helix /mail/lib/mailnews
%
SOURCE
/sys/src/cmd/auth/cron.c
SEE ALSO
con(1), rc(1)
CRON(8)