crontab priorities


 
Thread Tools Search this Thread
Operating Systems AIX crontab priorities
# 1  
Old 07-28-2008
crontab priorities

I have a user that wants to run a backup of an oracle database via a file copy. They shut down the database once a week, and do a full copy. She wrote a script to do this for her, and it works, but when she runs it from cron, it takes twice as long. I took a look, and found a way to get it to run as though she is at the console, but it does not seem to work. I have an excerpt from the script. She said that she has used the set +o bgnice to make it not use a lower priority, but it still takes twice as long when she does it via cron rather than interactively at the console. Does anyone know how to change the priority of the cron job? We don't really want it to run under the root cron (I think that is why the bgnice does not work) because she then has no way to change the schedule if she needs to. She is running this with a user privilege account rather than an elevated account. What is the best way to deal with this? Is there perhaps a group that would allow this sort of thing? Thanks for the help.

#set +o bgnice

echo "Starting u01 Copy..."
#sh +o bgnice copy_dir.sh u01 $backupname &
sh copy_dir.sh u01 $backupname &

echo "Starting u02 Copy..."
#sh +o bgnice copy_dir.sh u02 $backupname &
sh copy_dir.sh u02 $backupname &

echo "Starting u03 Copy..."
#sh +o bgnice copy_dir.sh u03 $backupname &
sh copy_dir.sh u03 $backupname &

echo "Starting u04 Copy..."
#sh +o bgnice copy_dir.sh u04 $backupname &
sh copy_dir.sh u04 $backupname &

echo "Starting u05 Copy..."
#sh +o bgnice copy_dir.sh u05 $backupname &
sh copy_dir.sh u05 $backupname &
# 2  
Old 08-06-2008
when she wrote the scripts she ran it one by one in console or in background one by one as defined crontab??
# 3  
Old 08-07-2008
When she runs the backup manually, she is just running the same script from the same location. The only thing that is different is that one way is from Cron, and the other is by command line.
# 4  
Old 08-07-2008
I don't know AIX but cron usually runs with nice 2 but this is controlled by the queuedefs file. Queues a, b, and c are for at, batch, and cron. I have never tried it, but you should be able to add a line for queue, say, o which defines a special queue and set the nice value to zero. Then you should be able to run the script from the console with "at -q o ...". If that works well put the "at" command in crontab. The "at" command itself will run with crons default priority, but it only takes a few seconds. Then the job it creates will run with whatever you set in the queuedefs file for queue o. I picked "o" for oracle, but you won't be able to stop other users from using queue o.
# 5  
Old 08-07-2008
try this

try adding these two lines in the begining of the script
#! bin/usr/sh
. $HOME/.profile
# 6  
Old 08-18-2008
The problem was probably that the script was using relative paths to the $PWD to reference the files being copied. When run from cron, cron's default directory is "/" and I'm guessing the files aren't there. If she were to put a "cd /path/to/files" at the begining of the script, it would probably fix it. A better way to program it would be to use full path names to the files being copied and a full path to the destination.
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

crontab

hi, i have to backup a database everyday on a Sun Microsystem. i have been looking around and have found that crontab might be the answer. the list of steps that have to be followed for me to get the database is: 1. on cmd telnet the equipment. 2. put the user name and password. 3. i... (20 Replies)
Discussion started by: vashil
20 Replies

2. UNIX for Dummies Questions & Answers

HELP with crontab

I am trying to create a crontab but I keep getting a "bad minute" error. Here is what I am entering: */5****/usr/bin/php/ {path to script} After I exit the editor and save I get the following message: crontab: installing new crontab "/temp/crontab." :-2: bad minute errors in... (2 Replies)
Discussion started by: fcocnews
2 Replies

3. Shell Programming and Scripting

mailx to set priorities

Hi, can we set priority to mails which I have sent using mailx? Is there any options in mailx for that? I am receiving mails on Microsoft Outlook (4 Replies)
Discussion started by: Deei
4 Replies

4. Virtualization and Cloud Computing

ionice command to set i/o priorities for domUs

Hi, I have xen on a debian lenny with more then 20 VM. The supermicro server has a raid10 with a good performance, but I have IO issues when one VM is making backup, it affects the performance of the other VMs. I've setup cpus, vcpus, sched-credit between dom0 and domUs as doc recommended, but... (0 Replies)
Discussion started by: iga3725
0 Replies

5. UNIX for Dummies Questions & Answers

How to get the last crontab

Hi all, can anybody tell how to get the last crontab if it is deleted. is there any way to get the crontab back? or it will it be staored anywhere ? its very urgent, can anybody help for the same? Thanks, Vinay (5 Replies)
Discussion started by: vinayakatj56
5 Replies

6. Programming

setting thread priorities

hi all: ->could someone tell how 2 set thread priorities in a prg -> also how to create multiple dynamic threads.. help me.... (1 Reply)
Discussion started by: bankpro
1 Replies

7. UNIX for Advanced & Expert Users

Crontab

Hai , the working the path and representation of crontab application will differs from flavour to flavour in linux if so will any one plz tell me how it differs . its urgent :confused: Regards Sanju (1 Reply)
Discussion started by: sanjustudy
1 Replies

8. UNIX for Dummies Questions & Answers

crontab

Hi I have a shell script which works fine at the command line and does works in crontab also but does not send the output to mail as other scripts do by default. 10 1 * * * /export/home/test/report_script by default should send the output to mail but the script runs OK and the output... (1 Reply)
Discussion started by: run_time_error
1 Replies
Login or Register to Ask a Question