Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

(sunos section 1m)
man page for smcron

smcron(1M)						  System Administration Commands						smcron(1M)

NAME
smcron - manage jobs in the crontab database SYNOPSIS
/usr/sadm/bin/smcron subcommand [ auth_args] -- [subcommand_args] DESCRIPTION
The smcron command manages jobs in the crontab(1) database. subcommands smcron subcommands are: add Adds a job to the crontab(1) database. To add a job, the administrator must have the solaris.jobs.user authorization. To add a job to another user's crontab file, the administrator must have the solaris.jobs.admin authorization. delete Deletes a job from the crontab(1) database. To delete a job, the administrator must have the solaris.jobs.user authoriza- tion. To delete a job from another user's crontab file, the administrator must have the solaris.jobs.admin authorization. list Lists one or more jobs in the crontab(1) database. To list all jobs, the administrator must have the solaris.jobs.user authorization. To list a job in another user's crontab file, the administrator must have the solaris.jobs.admin authoriza- tion. No authorization is needed to list a user's own jobs. modify Modifies a job in the crontab(1) database. To modify a job, the administrator must have the solaris.jobs.user authoriza- tion. To modify a job in another user's crontab file, the administrator must have the solaris.jobs.admin authorization. OPTIONS
The smcron authentication arguments, auth_args, are derived from the smc(1M) arg set and are the same regardless of which subcommand you use. The smcron command requires the Solaris Management Console to be initialized for the command to succeed (see smc(1M)). After reboot- ing the Solaris Management Console server, the first Solaris Management Console connection might time out, so you might need to retry the command. The subcommand-specific options, subcommand_args, must come after the auth_args and must be separated from them by the -- option. auth_args The valid auth_args are -D, -H, -l, -p, -r, and -u; they are all optional. If no auth_args are specified, certain defaults will be assumed and the user may be prompted for additional information, such as a password for authentication purposes. These letter options can also be specified by their equivalent option words preceded by a double dash. For example, you can use either -D or --domain with the domain argu- ment. -D | --domain domain Specifies the default domain that you want to manage. smcron accepts only file for this option. file is also the default value. The file default domain means that changes are local to the server. Toolboxes can change the domain on a tool-by-tool basis; this option specifies the domain for all other tools. -H | --hostname host_name:port Specifies the host_name and port to which you want to connect. If you do not specify a port, the system connects to the default port, 898. If you do not specify host_name:port, the Solaris Management Console connects to the local host on port 898. You may still have to choose a toolbox to load into the console. To override this behavior, use the smc(1M) -B option, or set your console preferences to load a "home toolbox" by default. -l | --rolepassword role_password Specifies the password for the role_name. If you specify a role_name but do not specify a role_password, the system prompts you to sup- ply a role_password. Passwords specified on the command line can be seen by any user on the system, hence this option is considered insecure. -p | --password password Specifies the password for the user_name. If you do not specify a password, the system prompts you for one. Passwords specified on the command line can be seen by any user on the system, hence this option is considered insecure. -r | --rolename role_name Specifies a role name for authentication. If you do not specify this option, no role is assumed. -u | --username user_name Specifies the user name for authentication. If you do not specify this option, the user identity running the console process is assumed. -- This option is required and must always follow the preceding options. If you do not enter the preceding options, you must still enter the -- option. subcommand_args For the time-related subcommands described below, -m, -M, -t, and -w, you can enter multiple arguments, separated only by commas. smcron will construct crontab entries appropriate for your arguments. See EXAMPLES. Note: Descriptions and other arg options that contain white spaces must be enclosed in double quotes. o For subcommand add: -c command Specifies the command that you want to run. -h (Optional) Displays the command's usage statement. -m day_of_month (Optional) Specifies the day of the month you want to run the job. Valid values are 1-31. If you specify both -t and -m options, the job executes one day per month at the time specified by -t. -M month (Optional) Specifies the month that you want to run the job. Valid values are 1-12. If you specify both -t and -M options, the job executes during the specified month at the time specified by -t. -n name Specifies the unique name of the job. -o owner (Optional) Specifies the user name that is the owner of the job. If you do not specify this option, the user name specified by the -U option is assumed. -t time_of_day Specifies the time (in hh:mm) that you want to execute the command. If no other time-related options are specified (-m, -M, or -w), the job executes every day at the time specified by -t. If you specify both -t and -w options, the job executes one day per week at the time specified by -t. If you specify both -t and -m options, the job executes one day per month at the time specified by -t. If you specify both -t and -M options, the job executes each day during the specified month at the time specified by -t. -w day_of_week (Optional) Specifies the day of the week you want to execute the command. Valid values are as follows: o 0=Sunday o 1=Monday o 2=Tuesday o 3=Wednesday o 4=Thursday o 5=Friday o 6=Saturday If you specify both -t and -w options, the job executes one day per week at the time specified by -t. o For subcommand delete: -h (Optional) Displays the command's usage statement. -n name Specifies the unique name of the job. -o owner (Optional) Specifies the user name that is the owner of the job. If you do not specify this option, the user name specified by the -U option is assumed. o For subcommand list: -f n|s|v (Optional) Specifies the format of the output. See EXAMPLES for examples of each output type. o n -- Displays the data in native format, as it appears in the crontab(1) database. o s -- Default format. Displays the data in summary format. o v -- Displays the data in verbose format. -h (Optional) Displays the command's usage statement. -o owner (Optional) Lists all jobs for the specified owner (user name). If you do not specify this option, all jobs in the crontab(1) data- base are listed. o For subcommand modify: -c command (Optional) Specifies the command that you want to run. -h (Optional) Displays the command's usage statement. -m day_of_month (Optional) Specifies the day of the month you want to run the job. Valid values are 1-31. If you specify both -t and -m options, the job executes one day per month at the time specified by -t. -M month (Optional) Specifies the month that you want to run the job. Valid values are 1-12. If you specify both -t and -M options, the job executes during the specified month at the time specified by -t. -n name Specifies the current unique name of the job. -N new_name (Optional) Specifies the new unique name of the job. -o owner (Optional) Specifies the user name that is the owner of the job. If you do not specify this option, the user name specified by the -U option is assumed. -O new_owner (Optional) Specifies the new owner of the job. -t time_of_day (Optional) Specifies the time (in hh:mm) that you want to execute the command. If no other time-related options are specified (-m, -M, or -w), then the job executes every day at the time specified by -t. If you specify both -t and -w options, the job executes one day per week at the time specified by -t. If you specify both -t and -m options, the job executes one day per month at the time specified by -t. If you specify both -t and -M, then the job executes each day during the specified month at the time speci- fied by -t. -w day_of_week (Optional) Specifies the day of the week you want to execute the command. Valid values are as follows: o 0=Sunday o 1=Monday o 2=Tuesday o 3=Wednesday o 4=Thursday o 5=Friday o 6=Saturday If you specify both -t and -w options, the job executes one day per week at the time specified by -t. EXAMPLES
Example 1: Adding a Job The following adds a new job, owned by root, that removes the old log files from /tmp daily at 1:30 AM. ./smcron add -H myhost -u root -p mypassword -- -n "Remove old logs" \ -t 1:30 -c "rm /tmp/*.log" -o root Example 2: Deleting a Job The following deletes the job Remove old logs owned by root: ./smcron delete -H myhost -u root -p mypassword -- \ -n "Remove old logs" -o root Example 3: Listing Jobs in Native Format The following lists all jobs in native, or crontab(1), format: ./smcron list -H myhost -u root -p mypassword -- -f n MINUTE HOUR DATE MONTH DAY COMMAND 10 3 * * * /usr/sbin/logadm 15 3 * * 0 /usr/lib/fs/nfs/nfsfind 1 2 * * * [ -x /usr/sbin/rtc ] && /usr/sbin/rtc -c > /dev/null 2>&1 30 3 * * * [ -x /usr/lib/gss/gsscred_clean ] && /usr/lib/gss/gsscred_clean Example 4: Listing Jobs in Standard Format The following lists all jobs owned by lp in standard format: ./smcron list -H myhost -u root -p mypassword -- -f s -o lp NAME::OWNER::SCHEDULE::COMMAND NoName_1765663371::lp::Weekly on Sundays at 3:13 AM::cd /var/lp/logs; if [ -f requests ]; then if [ -f requests.1 ]; then /bin/mv requests.1 requests.2; fi; /usr/bin/cp requests requests.1; > requests; fi NoName_512822673::lp::Weekly on Sundays at 4:15 AM::cd /var/lp/logs; if [ -f lpsched ]; then if [ -f lpsched.1 ]; then /bin/mv lpsched.1 lpsched.2; fi; /usr/bin/cp lpsched lpsched.1; >lpsched; fi Example 5: Listing jobs in verbose format The following lists all jobs in verbose format: ./smcron list -H myhost -u root -p mypassword -- -f v NAME::OWNER::SCHEDULE::NEXT_RUN::STATUS::COMMAND NoName_1075488942::root::Advanced::::Finished on Feb 10 3:10 with code 1 ::/etc/cron.d/logchecker databackup::root::Weekly on Sundays at 3:10 AM::3/19/00 3:10 AM ::Finished on Sep 19 3:10::/usr/lib/newsyslog runlog::root::Daily at 2:01 AM::3/14/00 2:01 AM::Finished on Feb 11 2:01 AM::/usr/sbin/rtc Example 6: Changing a Job The following modifies the job Remove old logs owned by root to execute daily at 2:00 AM: ./smcron modify -H myhost -u root -p mypassword -- -n "Remove old logs" \ -o root -t 2:00 Example 7: Specifying Multiple Time Arguments smcron allows you to specify a range of times for all of its time-related subcommands, -m, -M, -t, and -w. For example, the following com- mand: # smcron add -u root -p xxxx -- -n cronjob1 -w 1-4,5 \ -t 12:00,13:15,14:30 -c ls ...creates the following entry in crontab: 0,15,30 12,13,14 * * 1,2,3,4,6 ls #cronjob1 This job would run on Monday through Thursday and Saturday at the following times: 12:00 12:15 12:30 13:00 13:15 13:30 14:00 14:15 14:30 ENVIRONMENT VARIABLES
See environ(5) for a description of the JAVA_HOME environment variable, which affects the execution of the smcron command. If this envi- ronment variable is not specified, the /usr/java location is used. See smc(1M). EXIT STATUS
The following exit values are returned: 0 Successful completion. 1 Invalid command syntax. A usage message displays. 2 An error occurred while executing the command. An error message displays. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWmga | +-----------------------------+-----------------------------+ SEE ALSO
crontab(1), cron(1M), smc(1M), attributes(5), environ(5) NOTES
The 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. SunOS 5.10 24 Mar 2003 smcron(1M)

Featured Tech Videos