Suppress cron from logging a cron job
I have a cron job that I'm running once per minute. I don't want to have the /var/log/crond.log get updated 60 times per hour. How can I suppress the logging of the job?
I've tried adding the following to the cron line but they just get logged right along with it!
*/1 * * * * /path/to/script > /dev/null
*/1 * * * * /path/to/script > /dev/null 2>&1
@st - I can change the /etc/conf.d/crond to a lower level (default is CROND_ARGS="-S -l info") but I'm only interested in stopping the activity for a specific job; changing it from info to notice will be a global setting.
* debug - Debug level message
* info - Informational message
* notice - Normal but significant conditions
* warning, warn (depreciated) - Warning conditions
* err, error (depreciated) - Error conditions
* crit - Critical conditions
* alert - Action must be taken immediately
* emerg, panic - System is unusable
Last edited by graysky (2010-12-24 20:01:59)
Similar Messages
-
How to suppress "exit status 0" log mail for cron job
Hello,
we have a shell script to collect stats every day. it is croned.
Recently, in the moning, get email to say "Output from cron job xxxx, in server xxx, exit status 0",
As we know, the job is done well everyday without error(exit 0), but my question is how to let server to stop sending this useless alert email everyday.
any trick?
thank you.
cc: the script
case $1 in
-? ) cat $0 | grep "#H" | grep -v "grep"
exit
esac
case $1 in
-? ) cat $0 | grep "#H" | grep -v "grep"
exit
esac
if [ -n "$1" ]; then
ORACLE_SID=$1
else
return
fi
if [ -n "$2" ]; then
SCHEMA=$2
else
return
fi
TOOLS=/opt/dba/oraadmin/tools
TABLE=xxx
COLUMN=xxx
. /opt/dba/oraadmin/tools/ora_env.sh -S $ORACLE_SID
LOG_FILE=$SVR_LOG/dbms_stats_xxx.log
echo $LOG_FILE
$ORACLE_HOME/bin/sqlplus '/ as sysdba' << !EOF > $LOG_FILE
set echo on;
exec dbms_stats.gather_table_stats('$SCHEMA','$TABLE');
exec dbms_stats.gather_table_stats('$SCHEMA','$TABLE', method_opt => 'for columns $COLUMN size 1', cascade => FALSE);
DECLARE
n_distcnt NUMBER;
v_Owner varchar2(100) := '$SCHEMA';
v_TABLE_NAME varchar2(100) := '$TABLE';
v_COL_NAME varchar2(100) := '$COLUMN';
BEGIN
select round(num_rows/3,0) into n_distcnt from all_tables where owner = v_Owner and table_name = v_TABLE_NAME;
--and then just set statistics
DBMS_STATS.set_column_stats (v_Owner,
v_TABLE_NAME,
v_COL_NAME,
distcnt => n_distcnt);
END;
exit;
EOF
Edited by: 795980 on Aug 2, 2011 7:43 AM795980 wrote:
Hello,
we have a shell script to collect stats every day. it is croned.
Recently, in the moning, get email to say "Output from cron job xxxx, in server xxx, exit status 0",
As we know, the job is done well everyday without error(exit 0), but my question is how to let server to stop sending this useless alert email everyday.
any trick?
thank you.
cc: the script
case $1 in
-? ) cat $0 | grep "#H" | grep -v "grep"
exit
esac
case $1 in
-? ) cat $0 | grep "#H" | grep -v "grep"
exit
esac
if [ -n "$1" ]; then
ORACLE_SID=$1
else
return
fi
if [ -n "$2" ]; then
SCHEMA=$2
else
return
fi
TOOLS=/opt/dba/oraadmin/tools
TABLE=xxx
COLUMN=xxx
. /opt/dba/oraadmin/tools/ora_env.sh -S $ORACLE_SID
LOG_FILE=$SVR_LOG/dbms_stats_xxx.log
echo $LOG_FILE
$ORACLE_HOME/bin/sqlplus '/ as sysdba' << !EOF > $LOG_FILE
set echo on;
exec dbms_stats.gather_table_stats('$SCHEMA','$TABLE');
exec dbms_stats.gather_table_stats('$SCHEMA','$TABLE', method_opt => 'for columns $COLUMN size 1', cascade => FALSE);
DECLARE
n_distcnt NUMBER;
v_Owner varchar2(100) := '$SCHEMA';
v_TABLE_NAME varchar2(100) := '$TABLE';
v_COL_NAME varchar2(100) := '$COLUMN';
BEGIN
select round(num_rows/3,0) into n_distcnt from all_tables where owner = v_Owner and table_name = v_TABLE_NAME;
--and then just set statistics
DBMS_STATS.set_column_stats (v_Owner,
v_TABLE_NAME,
v_COL_NAME,
distcnt => n_distcnt);
END;
exit;
EOF
Edited by: 795980 on Aug 2, 2011 7:43 AM1) problem & solution have NOTHING to do with Oracle RDBMS & is Scripting 101 Basics
2) posted script does NOT send any email so does not contribute to problem or solution.
my question is how to let server to stop sending this useless alert email everyday.The obvious solution is to NOT send the message.
code sending script to stop being a spam-o-gram generator -
How to take the cron job log in HP UX?
Hi,
How to take the cron job log in HP UX
I need to run a backup and other stuff everyday. How do I check and start cron service under HP-UX UNIX operating system? How do I write cron jobs?
A. Cron service is required to run jobs and tasks such as backup.
You must login as the root to run following commands. Each user that is using the cron service must have a cron configuration file in the /var/spool/cron/crontab directory. Also users are permitted if their name appeared in /var/adm/cron/cron.allow file
Task: Find out if cron is running under HP-UX
Type the following command at a shell prompt
# ps -ef | grep cron
Open /etc/rc.config.d/cron file
vi /etc/rc.config.d/cron
Set control variable to 1 to enable cron: CRON=1
Set control variable to 0 to disable: CRON=0
Close and save the file. To start or stop cron you can type the following command:
# /sbin/init.d/cron start <-- start cron
# /sbin/init.d/cron stop <-- stop cron
Task: HP-UX Start cron service
If cron is not running, simply type:
# cron
Task: Edit / create cron jobs
Type the following command to submit a cron job:
# crontab -e
List your cron file:
# crontab -l
Backup all your cron jobs:
# crontab -l > ~/backup.cron.jobs
Remove ALL cron job:
# crontab -r
Task: Crontab file format
Cron file format is as follows:
MIN HOUR DATE MONTH DAY /PATH/TO/COMMAND
0-59 0-23 1-31 1-12 0-6 /root/scripts/backup2tape.shEasy to remember crontab file format:
* * * * * command to be executed
| | | | |
| | | | ----- Day of week (0 - 7) (Sunday=0 or 7)
| | | ------- Month (1 - 12)
| | --------- Day of month (1 - 31)
| ----------- Hour (0 - 23)
------------- Minute (0 - 59)To run /root/script/backup at 23:00, every day, enter:
# crontab -e
Append following
0 23 * * * /root/script/backupRun foo job very weekday (MON-Fri) at 6am, enter:
0 6 * * 1-5 /root/script/backupFor more information refer to cron and crontab man pages.
Subscribe to our free e-mail newsletter or RSS feed to get all updates. You can Email this page to a friend.
Related Other Helpful FAQs:
What is Cron?
Linux Start and stop the cron or crond service
Run crontab Every 10 Minutes
Linux / UNIX Setup and run php script as a cron job
Stop Ubuntu / Debian Linux From Deleting /tmp Files on Boot
Discussion on This FAQDavid Says:
January 15th, 2008 at 12:21 am
You might note that all files normally found in /etc/init.d, /etc/rc*.d, and others are all in /sbin in HP-UX 10.20 and up.
Note too that your formatting is off in the description of the /etc/rc.config.d/cron file. Also, if you run /usr/bin/cron instead of /sbin/init.d/cron start, the /etc/rc.config.d/cron file is not used.
Regards,
SatyaI guess it would :)
btw, how did this piece miss from the contents pasted by the OP ?
The doc has given all details of CRON and missed where to see the logfiles. :)
****Added****
I tried man crontab in windows, i dont see it.i overlook most of the things, i would have done the same ;)
Edited by: Bobcatalog on Oct 23, 2008 9:40 AM -
Mount USB/Firewire drive from shell or cron job
Is there a way to mount a USB/Firewire drive from the shell or possibly mount it using a cron job? Here's the situation. I have a user that keeps all of her data on her desktop or in her Documents folder. I have attached a firewire drive to her PowerMac G5 (OS 10.4.6) and successfully created cron jobs to backup her entire user folder every night. The problem is that she logs off of her computer before she leaves work. When she logs of the firewire drive unmounts and the cron job fails because it cannot find the drive. I was hoping there was a way to mount the drive using a script so that it will mount, let the cron job run, and then possibly unmount the drive afterwards. Any help with this would be much appreciated.
MacMini, PowerMac G5, iMac Mac OS X (10.4.7)Try adding the following line to the beginning of the job:
mount -a
You may need to add u and/or w to the command after the a without any additional spaces for the mount to work properly.
(13951) -
[SOLVED] Cron Job that starts every 30 minutes from boot
I wish to have a cron job that runs a script every 30 minutes from boot, without any users logging in.
I know about crontab -e, but I think that would I only run once i'm logged in. I've also heard about @reboot, but that would only run the script once.
RabbidRabbit
Last edited by rabbidrabbit (2012-01-31 20:14:13)Cron jobs will run whenever the system is up, regardless of whether or not anyone is logged in.
I don't remember the syntax, but I know that at least some cron implementations have a way to run a job every 30 minutes, starting for the first time 30 minutes after reboot.
EDIT: I just checked the syntax for fcron, which is what I use, and it seems like doing @ 30 your/command/here will make it run every 30 minutes of uptime.
Last edited by kyla (2012-01-31 00:17:30) -
How to Create Linux-Cron Job from a Java Program
Hello,
Can anybody help me to CREATE/EDIT/DELETE Linux Cron job from Java Program. Its Very Urgent.Thanks in advance..
from
ChakriI decided this didn't sound too tough so I played around with it a little. Basically because I'd never tried executing external processes out of java before, so I wanted to see how it was done.
Just change whatever you like in the jobs ArrayList and call writeJobs.
If you call writeJobs without putting anything in the list first you'll wipe out all of your crontab entries.
import java.lang.*;
import java.io.*;
import java.util.*;
public class cron {
ArrayList jobs;
Runtime rt;
cron() {
rt = Runtime.getRuntime();
jobs = new ArrayList();
void readCron() {
String[] list = { "crontab", "-l" };
jobs = new ArrayList();
try {
// Stick a job into crontab
Process child = rt.exec(list);
BufferedReader cronout = new BufferedReader(new InputStreamReader(child.getInputStream()));
String cronjob = cronout.readLine();
while (cronjob != null) {
jobs.add(cronjob);
cronjob = cronout.readLine();
child.waitFor();
catch(IOException e) {
System.err.println("IOException starting process!");
catch(InterruptedException e) {
System.err.println("Interrupted waiting for process!");
void listJobs() {
Iterator iter = jobs.iterator();
while (iter.hasNext()) {
System.out.println((String)iter.next());
void writeJobs() {
String[] edit = { "crontab"};
try {
// Stick a job into crontab
Process child = rt.exec(edit);
PrintWriter cronIn = new PrintWriter(child.getOutputStream());
Iterator iter = jobs.iterator();
while (iter.hasNext()) {
cronIn.println((String)iter.next());
cronIn.close();
child.waitFor();
catch(IOException e) {
System.err.println("IOException starting process!");
catch(InterruptedException e) {
System.err.println("Interrupted waiting for process!");
void doStuff() {
readCron();
listJobs();
jobs.add("* * * * 4 cronjob");
writeJobs();
readCron();
listJobs();
public static void main(String[] args) {
cron c = new cron();
c.doStuff();
} -
Hi,
You can use either OS cron job based log rotation
OR
Internal daemon log rotation.
It is recommeded to use OS cron job log rotation.
OS=Operating System
Regards,
Dakshin.
Developer Technical Support
Sun Microsystems
http://www.sun.com/developers/support. -
Difference of output from cron job & shell prompt
We have a script in production like:
sqlplus -s <username>/<password><<EOF
set head off
set feedback off
set numwidth 4
set serveroutput off
spool /tmp/test1.txt
prompt column1 , column2
select column1||' , '|| column2 from <table> where <condition>;
spool off;
EOF
echo "Best Regards," >> /tmp/test1.txt
echo "IT Team" >> /tmp/test1.txt
When run one time from the shell prompt, it gives the correct value like-
column1, column2
<column-1>, <column-2>
Best Regards
IT Team
But when I run it from a cron job twice the output is like-
column1, column2
<column-1>, <column-2>
Best Regards
IT Team
Best Regards
IT Team
The problem in the above output is that the bottom 2 statements,
Best Regards
IT Team
keep getting repeated the number of times when the cron job is run. If the cron job is run 3 times the set of 2 statements get repeated thrice.
I hope, I have been able to explain the problem.
Requesting a reply to my query.
RegardsLocking this duplicate post - Difference of output from cron job & shell prompt
-
Back on Nov 27, Charles Minow told me how to generate an email summarizing the results of the periodic daily/weekly/monthly jobs (by the way, Charles, thanx! Works great!).
So, now I'm wondering, for cron jobs located in /var/cron/tabs/, how would one similarly generate an email to be sent to an email address of one's choice, that detailed the outcome of each such cron job?
Thanx in advance!There are several ways of doing this.
By default the output of any cron job would be mailed to the user's local mail account, so one option would be to setup mail forwarding from the system to the user's regular mail account.
The other option is to simply pipe the output of the cron task to mail, like:
1 2 * * * /path/to/your/task | mail [email protected]
Now when the specified task runs, its output will be passed to mail and sent to the specified address. -
Help Please : Cron Job to automate load process
Hi
I am trying to automate data load process. I am loading data into a number of tables from flat files.
Currently I have a UNIX (SunOS) file with a bunch of SQLLDR commands and I changed permission on this file to executable. Every morning I execute this file to load data.
Now I want to automate this process by writing a cron job and scheduling it. I am running into a number of problems. I exported ORACLE_SID, ORACLE_HOME and PATH still cron is unable to find SQLLDR.
Whatelse am I missing. Here is my command file and cron file.
Please help!?!?!?
ORAENV VARiables
export ORACLE_HOME=/export/opt/oracle/product/8.1.6
export ORACLE_SID=fid1
export PATH=$PATH:$ORACLE_HOME/bin
.profile
. $HOME/oraenv
daily_full.sql file
export ORACLE_SID ORACLE_HOME PATH
sqlldr userid=user/pwd control=acct.ctl log=acct.log
sqlldr .......
Cron Job
16 11 * * 1-5 /apps/fire/data/loadscripts/daily_full.sql >> /apps/fire/data/loadscripts/fulllog.log 2>&1
Output fulllog.log file
/apps/fire/data/loadscripts/daily_full.sql: sqlldr: not found
/apps/fire/data/loadscripts/daily_full.sql: sqlldr: not found
Thanks
ShanthiHi Ramayanapu,
first; you have written a shell-script not an sql-script. Please rename your file from daily_full.sql to daily_full.sh
I suggest that you use the cronjob from a user who has the enviroment with the variables ORACLE_SID and ORACLE_HOME.
In this case cron will operate from the $HOME variable of this user.
Perhaps your export will destroy the .kshrc setting. The statement has no effect in your script, please remove it.
Rename your sqlldr-Statement as follows;
$ORACLE_HOME/bin/sqlldr userid=user/pwd control=<path>acct.ctl log=acct.log
<path> will placed with the path of your controlfile.
Your user/pwd will correspond with a ORACLE user who has the right to insert in the destination table.
Your logfile will be place in the %HOME directory.
Hope that i could help to solve your problems
with kind regards
Hans-Peter -
Cron job to start machine.
Is there a way to get the machine to start, open iTunes and start playing a song at a specified time using a cron job?
MacBook Pro 15.4" - Intel Core Duo 2.0 Mac OS X (10.4.6) 2GB RAMI have my computer do exactly what you want yours to do, except I don't use a cron job. In case you don't actually need to use cron, I'll tell how I get it to happen.
As mentioned by Federico_82, I use the Energy Saver preferences in System Preferences. There is an "Schedule..." button in the lower right corner that will allow you set the startup and/or shutdown times for the computer. It's not very detailed, but it suits my purposes for waking up Monday through Friday.
I also have the computer automatically log me in using the Login Options in Accounts preferences in System Preferences.
Finally, I've set alarms in iCal and chose "Open file" in the alarm section of the Info drawer. You can select a song file (or anything really) to be opened and the song will be played with iTunes since songs should automatically open with iTunes.
I've also set the final option in the alarm section to perform this 5 minutes before the time I set for the event, with the event time being the same time as the computer startup. This is okay because it will perform an alarm that was suppose to happen even if it couldn't do it earlier, for example because the computer was off. So you don't have to worry about timing it perfectly. Just set the alarm time to the same as the startup time for the computer or earlier if you want it to happen immediately upon startup, then the alarm will go off immediately after computer turns on and logs you in.
Also keep in mind you can set the event to repeat at various intervals in iCal, such as Monday through Friday or various discontinuous days of the week every week, and so on. Very customizable.
Personally, I use an Automator app to start playing a playlist in iTunes, and to set the iTunes volume to an appropriate level to wake up with just in case I've change the volume the last time I used iTunes. In this way, I can simply change the song in the playlist in iTunes without having change the alarm event in iCal. This helps because then I can copy/paste the alarm anywhere I want and don't have to worry about finding another song file if I want to change the song. Instead, I simply find the song I want in iTunes and put it in the playlist, along with any other songs I want have played.
If you do it with an Automator workflow, simply save the workflow as an iCal Alarm with "Save As Plug-in...". It'll automatically save in your ~/Library/Workflows/Applications/iCal folder, without you having to figure that out. Oh, and it doesn't hurt to test the workflow to make sure it plays your playlist (or whatever you have it do) before saving it as an iCal Alarm. Though, you can re-edit later if you want.
Once you've saved your workflow as an iCal Alarm, it'll show up in list of files to open in the alarm section for the event. So, after you've chosen "Open file" in that section, the default for the file will be "iCal", but you'll also be able to choose any iCal alarms you've saved in Automator or any other file (such as a document or a song).
Just as a bit of trivia, a plug-in you save in Automator is actually the same thing as saving your workflow as an application. The only difference is that the app is saved to a specific location so the Finder, or iCal, or Image Capture, etc., can find it. So, you don't have to know where to save it, Automator does that for you, but I told you where it is anyways (though you could use Spotlight) so you can get to it to edit it again if you want. Just drag and drop the app onto Automator or open it from within Automator to edit it again.
I hope that helps. Though it might sound kind of complicated at first, I think this way is much easier than dealing with a crontab and trying to synchronize it with startup and so on. You'll also find this way very customizable with the various options for iCal alarms and the many possibilities with Automator (if you choose to use a workflow instead of simply a song file). -
How to Run cron Jobs(Schduled jobs)
HI all,
I am runnig one webapplication in resin.In resin web.xml run at tag like below
<run-at>01:50,03:50</run-at>This tag is used for runnig some periodic jobs.I want to cleanup the database every day at above mentiond timings.But in tomcat htere is no option like that.Is there any way to develope cron jobs please help me.
Thanks in advanceDo you have other tasks in cron?
I will assume not. You have to make sure you have permissions to do cronjobs.
If so, then just type crontab -e
From here you can use the following guideline to make your cronjob. Also source your .profile or whatever in your shell script.
Minute = Minute of the hour, 00 to 59. * Will indicate every minute (details later)
Hour = Hour of the day in 24-hour format, 00 to 23. * Will indicate every hour (details later)
Day = Day of the month, 1 to 31. * Will indicate every day (details later)
Month = Month of the year, 1 to 12. * Will indicate every month (details later)
Day = Day of the week, 3 chars - sun, mon, tue, or numeric (0=sun, 1=mon etc).... * Will indicate every day (details later)
Task = The command you want to execute
So if I had a shell script called runme.sh and in it it called my .profile (which sets my oracle_home and path etc) and it also called sqlplus and ran my script this is how I would set it up. Let's assume we want it to run 10 minutes after midnight every night.
10 0 * * * runme.sh
Let's assume you want a log, then it can look like this.
10 0 * * * runme.sh 1> path/filename.log 2> path/errorlog.err
If you wanted to just run it from Monday through Friday, then do this.
10 0 * * 1,2,3,4,5 runme.sh
Hope this helps. -
Hello,
Which is the best way to create a cron job for a sql script?
Thank you!1) each time you change your cron settings, add a job, delete, etc. save the latest state into a text file, dated. this way you have a log of changes. Example:
crontab -l > cron.mmddyy
2) make sure you have standard include files that contain all the environment (ORACLE_HOME, ORACLE_SID) and user names+passwords. These should be kept separate from the scripts, so that:
- you can include them in all scripts
- apply strict security access
the script can apply the env files to get the info. same as you apply the "oraenv" command in your shell prompt.
3) make sure each cron job leaves a detailed log, including errors. Examine the logs on a frequent basis. The shell script should try to catch errods and email them to the admin whenever possible. Example:
0 0 * * * /folder/script.sh /folder2/script.env > /folder3/script.log 2>&1 -
I have a script that I wrote to backup a server at midnight every night. It uses rsync to perform the backup. The past two nights it has run it seems to cause the server to crash. I used the Terminal to setup a cron job to run the script. Does this sound like a serious error or am I doing something completely wrong, or should it maybe be done at a different time? I looked through the logs and the kernel seems to panic and call crashdump or panicdump.
The system in question is a Mac Mini if it makes any difference. If anyone would like I could post the script.
TomHere is the script file. I tried changing the time the script is run from midnight to 1AM and it ran the problem was that it ran about 60 times!!!!
Is this a problem with the cron job because I see no problems with my script. I can successfully run it from the command line.
#!/bin/bash
DIRS=(/Applications /Developer /Groups /Library "/Shared Items" /System /Users /bin /opt /private /sbin /sw /usr)
###### DON'T CHANGE BELOW HERE ######
LOGS_DIR="/Library/Logs/Backup"
MACHINE=`hostname -s`
RSYNC_FLAGS=" -avz -e ssh --eahfs --delete" # These shouldn't need changed
DATE=`date +%m%d%G`
RSYNC_BIN="/usr/local/bin/rsync"
if [ ! -d "$LOGS_DIR" ]; then
mkdir $LOGS_DIR
fi
if [ -z "$1" ]; then
echo "usage: $0 <daily|weekly>"
exit
fi
TYPE=$1
if [ "$TYPE" = "daily" ]; then
TYPE="Daily"
elif [ "$TYPE" = "weekly" ]; then
TYPE="Weekly"
else
echo "Bad Option please use daily or weekly"
exit
fi
BACKUP_DIR="146.186.147.152:/Volumes/Backups_${TYPE}/${MACHINE}/"
#echo "${RSYNC_BIN} ${RSYNC_FLAGS} "${DIRS[@]}" ${BACKUP_DIR} >& ${LOGS_DIR}/${TYPE}_${DATE}.log"
#${RSYNC_BIN} ${RSYNC_FLAGS} "${DIRS[@]}" ${BACKUP_DIR} >& ${LOGS_DIR}/${TYPE}_${DATE}.log
#echo "${RSYNC_BIN} ${RSYNC_FLAGS} "${DIRS[@]}" ${BACKUP_DIR}"
${RSYNC_BIN} ${RSYNC_FLAGS} "${DIRS[@]}" ${BACKUP_DIR} -
Cron jobs on Sun Solaris 5.10
Hi,
Following are the details of my Sun box:
SunOS ocmdf2 5.10 Generic_118833-33 sun4u sparc SUNW,Sun-Fire-V490
I am trying to set up cron job entries using the crontab file. I have copied over my crontab file from the HP-UX machine over to this Sun machine.
I have registered the file with the cron system by running the "crontab crontab.txt" command where contab.txt contains all my cron job entries. After doing so, I noticed that non of the cron jobs are getting executed. One of the cron job is given below for reference:
0 6 * * 2,3,4,5,6 . /usr/local/bin/all_roots > /dev/null 2>&1 ; ksh $TF_FEED_SRC/generate_feed_contents.com standard_feed > $TF_FEED_LOG/standard_feed.cron.log 2>&1
The above cron job entry runs fine on the HP-UX machine, but not on the Sun machine.
Following is the modified version of the above job for the Sun machine.
0 6 * * 2,3,4,5,6 (/usr/bin/ksh ". .profile ; cd /tapes/gen_scripts ; generate_feed_contents.com standard_feed > /tapes/logs/standard_feed.cron.log 2>&1")
Note that in the above modified job, the env variables like TF_FEED_SRC and TF_FEED_LOG are replaced with the actual paths and quotes and parenthesis are used.
Can somebody please advise on:
1) Why the original cron job does not run?
2) What should I do to make the original cron job run?
3) What makes the modified cron job runs?
Thanks in advance for your help.
Regards,
ShivShivkumarSoni wrote:
From the above shown email, it is clear that the shell used by cron is sh and not ksh. May be this is the reason why the /usr/local/bin/all_roots script is not able to run properly and due to this the
environment variables are not getting set.That's exactly correct. From the crontab man page:
The shell is invoked from your $HOME directory with an arg0
of sh. Users who desire to have their .profile executed must
explicitly do so in the crontab file. cron supplies a
default environment for every shell, defining HOME, LOGNAME,
SHELL(=/bin/sh), TZ, and PATH. The default PATH for user
cron jobs is /usr/bin; while root cron jobs default to
/usr/sbin:/usr/bin. The default PATH can be set in
/etc/default/cron; see cron(1M).
Can anyone help to understand what is going on here and how to fix it?Set the variables before running the program
Method 1) set in the crontab
* * * * * VAR=value /path/to/script --option=$VAR
Method 2) use a wrapper script
* * * * * /path/to/wrapper
While cron will use /bin/sh to run the line, there's nothing that keeps the wrapper script from being anything in particular (such as a ksh script).
Darren
Maybe you are looking for
-
I want to implement the image in my report
Hi I am replicating some of the sample report of SQL Servers in BusinessObjects XI R3.1. One of the SQL Sever's report is of product catalogue type that gives complete information like name, category, description along with the products image etc...
-
Iphone 3gs isnt being recognised by itunes and screen just frozen
iphone 3gs 16gb plugged into main desktop but it has frozen on iphone screen and isnt being recognised by the computer at all,not bringing up itunes at all and when open itunes it doesnt recognise the iphone. Iv tried following the reset and restore
-
Prime Infrastructure v2 - want to increase Swap space
Hello, How can we increase Swap space at Prime Infrastructure v2.x? Do we keep TAC support? Will the installations with increased swapspace be still upgradeable? We monitor customer systems and there are CPI's as well via CA Spectrum. Some of them ge
-
What is the small padlock on the top of my iPhone lockscreen?
Hey guys, I am wondering what the small padlock on my lockscreen is, it's directly in the center and it has no arrow around it. The padlock is in the locked position and it has only been that way since I have had trouble turning my keyboard sideways.
-
I have an item which is managed by serial no.When I sell this item i.e. add a A/R invoice , a form of serial no. selection is opened.I assign serial no. and then add the A/R invoice. This is the standard functionality of SAP. I have created a form us