Sponsored Content
Full Discussion: Trouble with cron
Operating Systems Linux Trouble with cron Post 303018857 by killerserv on Sunday 17th of June 2018 10:59:04 PM
Old 06-17-2018
Trouble with cron

Hello World!
Need some advise. I setup few crons on my server, but to my surprise none of them seems working. Any idea what am i missing here? Is group rights a must in order for cron to run?

Crontab:
Code:
mandrel@sp74t0006c :[/etc/cron.d(14825)]$cat /etc/crontab
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# For details see man 4 crontabs

# Example of job definition:
# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# |  |  |  |  |
# *  *  *  *  * user-name command to be executed

mandrel@sp74t0006c :[/etc/cron.d(14825)]$

My cron:
Code:
#################################################################################################################
#
5 * * * * /opt/fabpkg/home/mandrel/data_adm/sophi/mapsmove/run_mandrel_mapsmove.sh > /dev/null 2>&1
20 * * * * /opt/fabpkg/home/mandrel/data_adm/sophi/oref_inspect/run_oref_inspect.sh > /dev/null 2>&1
25 * * * * /opt/fabpkg/home/mandrel/data_adm/sophi/oref_inspect_bdft/run_oref_inspect_bdft.sh > /dev/null 2>&1
30 * * * * /opt/fabpkg/home/mandrel/data_adm/sophi/sizedata/run_sizedata.sh > /dev/null 2>&1
35 * * * * /opt/fabpkg/home/mandrel/data_adm/sophi/summary/run_sophia_summary.sh > /dev/null 2>&1
0,10,20,30,40,50 * * * * /opt/fabpkg/home/mandrel/data_adm/sophi/qc/run_qc_daemon.sh > /dev/null 2>&1
5,15,25,35,45,55 * * * * /opt/fabpkg/home/mandrel/data_adm/sophi/ellipsometer/run_ellipsometer_daemon.sh > /dev/null 2>&1
0,10,20,30,40,50 * * * * /opt/fabpkg/home/mandrel/data_adm/sophi/ivs/run_mandrel_ivs.sh > /dev/null 2>&1

---------- Post updated at 10:59 AM ---------- Previous update was at 10:41 AM ----------

Sorry guys, i should have be more careful. Ive screwed up with the paths. Corrected it and now it works.

Kindly delete this thread. My appology!
 

10 More Discussions You Might Find Interesting

1. AIX

AIX and cron logs filtering ?: /etc/cronlog.conf, /var/adm/cron/log

Hi, I can use 'crontabs –e' and do all the scheduling I like. However I would like to auto send myself just the cronjobs logs that fail. That is to say the PIDs that fail and the related lines with those PID’s only. (Not the full set of logs) Has anyone done this work? Or does an AIX 5.3 tool... (0 Replies)
Discussion started by: Keith Johnson
0 Replies

2. UNIX for Dummies Questions & Answers

CRON usage for CRON job

can anybody explain the usage of CRON for adding a cron job. please provide an example also for better understanding !!! Thanks (1 Reply)
Discussion started by: skyineyes
1 Replies

3. Solaris

cron job starts new cron proccess

I run cron in solaris 10 zone. One cron job which syncing files to nfs mounted on container, creates after finishing another cron proccess(/usr/sbin/cron), and after 100 existing cron proccesses next cron job will not start. It's too weird for me, I'm not able to solve this problem. Theoretically... (3 Replies)
Discussion started by: ron76
3 Replies

4. UNIX for Dummies Questions & Answers

Trouble with cron

Here is what my crontab shows when I do crontab -e # fields minute(0-59) hour(0-23) day(1-31) month(1-12) day of week (0-6, 0=sun) # 30 04 * * 06 /home/rkruck/scripts/shell/backup 15 9 * * * /home/rkruck/scripts/shell/get_passwd_files The first script runs no problem as... (5 Replies)
Discussion started by: rkruck
5 Replies

5. Solaris

User entry in both cron.allow and cron.deny

Hello All, Anybody please help me to know ,what happens when a user having entry in both cron.allow and cron.deny files.Wheather the user will be able to access the crontab??? Thanks in advance Vaisakh (5 Replies)
Discussion started by: ksvaisakh
5 Replies

6. UNIX for Dummies Questions & Answers

How are cron.allow and cron.deny read?

Hi, all! I was working on my Debian, minding my own business but then I wanted to see what happened if the same user was included on both cron.allow and cron.deny :p I would have bet that cron.deny was going to override cron.allow for security reasons, but my computer proved me wrong:... (3 Replies)
Discussion started by: pereyrax
3 Replies

7. Solaris

Cron job running even after cron is removed

Hi , I have removed a cron for particular user , but cron job seems to be running even after the cron entry is removed. The purpose of the cron was to sendmail to user ( it uses mailx utility ) I have restarted cron and sendmail service still user is getting mail alerts from the cron job. And... (4 Replies)
Discussion started by: chidori
4 Replies

8. Shell Programming and Scripting

Commented cron job -- cron monitoring

Hi I have a requirement to write a shell script,that will check the all commented job in cron job.Please help !! (2 Replies)
Discussion started by: netdbaind
2 Replies

9. Shell Programming and Scripting

Cron job - Need to run Cron every quarter at particular time

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

10. UNIX for Dummies Questions & Answers

Execution problem with Cron: Script works manually but not w/Cron. Why?

Hello gurus, I am making what I think is a simple db2 call from within a shell script but I am having difficulty producing the desired report when I run the script shown below from a shell script in cron. For example, my script and the crontab file setup is shown below: #!/bin/ksh db2... (3 Replies)
Discussion started by: okonita
3 Replies
crontab(1)							   User Commands							crontab(1)

NAME
crontab - user crontab file SYNOPSIS
/usr/bin/crontab [filename] /usr/bin/crontab -e [username] /usr/bin/crontab -l [username] /usr/bin/crontab -r [username] /usr/xpg4/bin/crontab [filename] /usr/xpg4/bin/crontab -e [username] /usr/xpg4/bin/crontab -l [username] /usr/xpg4/bin/crontab -r [username] /usr/xpg6/bin/crontab [filename] /usr/xpg6/bin/crontab -e [username] /usr/xpg6/bin/crontab -l [username] /usr/xpg6/bin/crontab -r [username] DESCRIPTION
The crontab utility manages a user's access with cron (see cron(1M)) by copying, creating, listing, and removing crontab files. If invoked without options, crontab copies the specified file, or the standard input if no file is specified, into a directory that holds all users' crontabs. If crontab is invoked with filename, this overwrites an existing crontab entry for the user that invokes it. crontab Access Control Users: Access to crontab is allowed: o if the user's name appears in /etc/cron.d/cron.allow. o if /etc/cron.d/cron.allow does not exist and the user's name is not in /etc/cron.d/cron.deny. Users: Access to crontab is denied: o if /etc/cron.d/cron.allow exists and the user's name is not in it. o if /etc/cron.d/cron.allow does not exist and user's name is in /etc/cron.d/cron.deny. o if neither file exists, only a user with the solaris.jobs.user authorization is allowed to submit a job. o if BSM audit is enabled, the user's shell is not audited and the user is not the crontab owner. This can occur if the user logs in by way of a program, such as some versions of SSH, which does not set audit parameters. The rules for allow and deny apply to root only if the allow/deny files exist. The allow/deny files consist of one user name per line. crontab Entry Format A crontab file consists of lines of six fields each. The fields are separated by spaces or tabs. The first five are integer patterns that specify the following: minute (0-59), hour (0-23), day of the month (1-31), month of the year (1-12), day of the week (0-6 with 0=Sunday). Each of these patterns can be either an asterisk (meaning all legal values) or a list of elements separated by commas. An element is either a number or two numbers separated by a minus sign (meaning an inclusive range). Time specified here is interpreted in the currently active timezone. At the top of the crontab file this is the timezone which is set system-wide in /etc/default/init. A user can add a line such as: TZ=timezone ...and all subsequent entries will be interpreted using that timezone, until a new TZ=timezone line is encountered. The specification of days can be made by two fields (day of the month and day of the week). Both are adhered to if specified as a list of elements. See EXAM- PLES. The sixth field of a line in a crontab file is a string that is executed by the shell at the specified times. A percent character in this field (unless escaped by ) is translated to a NEWLINE character. Only the first line (up to a `%' or end of line) of the command field is executed by the shell. Other lines are made available to the com- mand as standard input. Any blank line or line beginning with a `#' is a comment and is ignored. The shell is invoked from your $HOME directory. As with $TZ, both $SHELL and $HOME can be set by having a line such as: SHELL=/usr/bin/someshell ...or: HOME=somedirectory ...which will take precedence for all the remaining entries in the crontab or until there is another HOME or SHELL entry. It is invoked with an arg0 of the basename of the $SHELL that is currently in effect. A user who wants to have his .profile or equivalent file executed must explicitly do so in the crontab file. cron supplies a default environment for every shell, defining HOME, LOGNAME, SHELL, 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)). The TZ, HOME, and SHELL environment variables are set to match those that are in effect in the crontab file at the time. If you do not redirect the standard output and standard error of your commands, any generated output or errors are mailed to you. crontab Environment Variables The following variables are supported: HOME Allows the user to choose and alternative directory for cron to change directory to prior to running the command. For example: HOME=/var/tmp SHELL The name of the shell to use to run subsequent commands. For example: SHELL=/usr/bin/ksh TZ Allows the user to choose the timezone in which the cron entries are run. This effects both the environment of the command that is run and the timing of the entry. For example, to have your entries run using the timezone for Iceland, use: TZ=Iceland Each of these variables affects all of the lines that follow it in the crontab file, until it is reset by a subsequent line resetting that variable. Hence, it is possible to have multiple timezones supported within a single crontab file. The lines that are not setting these environment variables are the same as crontab entries that conform to the UNIX standard and are described elsewhere in this man page. Setting cron Jobs Across Timezones The default timezone of the cron daemon sets the system-wide timezone for cron entries. This, in turn, is by set by default system-wide using /etc/default/init. If some form of daylight savings or summer/winter time is in effect, then jobs scheduled during the switchover period could be executed once, twice, or not at all. OPTIONS
The following options are supported: -e Edits a copy of the current user's crontab file, or creates an empty file to edit if crontab does not exist. When editing is com- plete, the file is installed as the user's crontab file. The environment variable EDITOR determines which editor is invoked with the -e option. All crontab jobs should be submitted using crontab. Do not add jobs by just editing the crontab file, because cron is not aware of changes made this way. If all lines in the crontab file are deleted, the old crontab file is restored. The correct way to delete all lines is to remove the crontab file using the -r option. If username is specified, the specified user's crontab file is edited, rather than the current user's crontab file. This can only be done by root or by a user with the solaris.jobs.admin authorization. -l Lists the crontab file for the invoking user. Only root or a user with the solaris.jobs.admin authorization can specify a username following the -l option to list the crontab file of the specified user. -r Removes a user's crontab from the crontab directory. Only root or a user with the solaris.jobs.admin authorization can specify a username following the -r option to remove the crontab file of the specified user. EXAMPLES
Example 1 Cleaning up Core Files This example cleans up core files every weekday morning at 3:15 am: 15 3 * * 1-5 find $HOME -namecore 2>/dev/null | xargs rm -f Example 2 Mailing a Birthday Greeting This example mails a birthday greeting: 0 12 14 2 * mailx john%Happy Birthday!%Time for lunch. Example 3 Specifying Days of the Month and Week This example runs a command on the first and fifteenth of each month, as well as on every Monday: 0 0 1,15 * 1 To specify days by only one field, the other field should be set to *. For example: 0 0 * * 1 would run a command only on Mondays. Example 4 Using Environment Variables The following entries take advantage of crontab support for certain environment variables. TZ=GMT HOME=/local/home/user SHELL=/usr/bin/ksh 0 0 * * * echo $(date) > midnight.GMT TZ=PST 0 0 * * * echo $(date) > midnight.PST TZ=EST HOME=/local/home/myuser SHELL=/bin/csh The preceding entries allow two jobs to run. The first one would run at midnight in the GMT timezone and the second would run at midnight in the PST timezone. Both would be run in the directory /local/home/user using the Korn shell. The file concludes with TZ, HOME, and SHELL entries that return those variable to their default values. ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of crontab: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES, and NLSPATH. /usr/bin/crontab EDITOR Determine the editor to be invoked when the -e option is specified. This is overridden by the VISUAL environmental variable. The default editor is vi(1). PATH The PATH in crontab's environment specifies the search path used to find the editor. VISUAL Determine the visual editor to be invoked when the -e option is specified. If VISUAL is not specified, then the environment vari- able EDITOR is used. If that is not set, the default is vi(1). /usr/xpg4/bin/crontab EDITOR Determine the editor to be invoked when the -e option is specified. The default editor is /usr/xpg4/bin/vi. /usr/xpg6/bin/crontab EDITOR Determine the editor to be invoked when the -e option is specified. The default editor is /usr/xpg6/bin/vi. EXIT STATUS
The following exit values are returned: 0 Successful completion. >0 An error occurred. FILES
/etc/cron.d main cron directory /etc/cron.d/cron.allow list of allowed users /etc/default/cron contains cron default settings /etc/cron.d/cron.deny list of denied users /var/cron/log accounting information /var/spool/cron/crontabs spool area for crontab ATTRIBUTES
See attributes(5) for descriptions of the following attributes: /usr/bin/crontab +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ /usr/xpg4/bin/crontab +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWxcu4 | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ /usr/xpg6/bin/crontab +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWxcu6 | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ SEE ALSO
atq(1), atrm(1), auths(1), ed(1), sh(1), vi(1), cron(1M), su(1M), auth_attr(4), attributes(5), environ(5), standards(5) NOTES
If you inadvertently enter the crontab command with no arguments, do not attempt to get out with Control-d. This removes all entries in your crontab file. Instead, exit with Control-c. When updating cron, check first for existing crontab entries that can be scheduled close to the time of the update. Such entries can be lost if the update process completes after the scheduled event. This can happen because, when cron is notified by crontab to update the internal view of a user's crontab file, it first removes the user's existing internal crontab and any internal scheduled events. Then it reads the new crontab file and rebuilds the internal crontab and events. This last step takes time, especially with a large crontab file, and can complete after an existing crontab entry is scheduled to run if it is scheduled too close to the update. To be safe, start a new job at least 60 seconds after the current date and time. If an authorized user other than root modifies another user's crontab file, the resulting behavior can be unpredictable. Instead, the authorized user should first use su(1M) to become superuser to the other user's login before making any changes to the crontab file. Care should be taken when adding TZ, SHELL and HOME variables to the crontab file when the crontab file could be shared with applications that do not expect those variables to be changed from the default. Resetting the values to their defaults at the bottom of the file will minimize the risk of problems. SunOS 5.11 4 Feb 2009 crontab(1)
All times are GMT -4. The time now is 10:03 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy