In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces how to analyze the crontab environment of Solaris. The content is very detailed. Interested friends can use it for reference. I hope it will be helpful to you.
Introduction to crontab environment
The 1.cron service is available at / etc/init.d/cron
two。 Executable file / usr/sbin/cron
The 3.cron configuration file is in / etc/cron.d
File list:.proto,FIFO,at.deny,cron.allow,cron.deny,queuedefs
Connection file for 4.cron
/ usr/lib/cron/->.. /.. / etc/cron.d
5. User's crontab file location
Under the / usr/spool/cron/crontabs directory, named after the user name.
2.crontab service starts, stops
Cd / etc/init.d
. / cron start
. / cron stop
3.crontab command description
Crontab-l: lists the crontab files for the current user.
Crontab-l username: lists the crontab files for the specified user. (root users)
Crontab-e: edit the current user's crontab file.
Crontab-e username: edit the crontab file for the specified user. (root users)
Crontab-r: deletes the current user's crontab file.
Crontab-r username: deletes the crontab file for the specified user. (root users)
4.crontab syntax description
The syntax format of the user crontab file, each line of statements is: * command, each line represents a task, and there can be multiple lines of statements.
The first * field: 0: 59 indicates a score
The second * field: 1: 23 represents the hour
The third * field: 1: 31 represents the day
The fourth * field: 1 to 12 represents the month
The fifth * field: 0: 6 for the week (where 0 is Sunday)
Fifth command field: command to execute
To perform a task every 20 minutes, you can write:
0pr 20je 40 * command
To perform a task every 5 minutes, you can write:
0 command 5 10 10 15 20 25 30 35 40 40 50 55 *
To perform a task every minute, you can write:
0-59 * command
Crontab under solaris is different from that under linux. Linux supports
* / 5 means every 5 minutes
* / 20 means every 20 minutes
But solaris does not support it.
Editor settings for 5.crontab
If no editor is set, crontab-e invokes the default editor.
Set the editor: export EDITOR=vim, and then call crontab-e.
6. Give examples to illustrate
1. Export EDITOR=vim
2. Crontab-e, add:
0-59 * / export/home/netcool/cron_test.sh
Save, exit (: wq)
3. Vi / export/home/netcool/cron_test.sh
Echo "aaa" > > / export/home/netcool/cron_test.log
Chmod axix / export/home/netcool/cron_test.sh
4. Restart the service
Cd / etc/init.d/
. / cron stop
Ps-ef | grep cron to check whether it exists. You can execute more stop commands.
. / cron start
The solution to the problem that 7.Crontab does not implement
1.1. Make sure the path to execute the script is correct, preferably with the full path
1.2. Make sure the environment variables are correct
You can set the environment variable of $HOME/.profile in shell. You can add an environment variable script to shell, e.g.:
Export OMNIBUS_HOME=/opt/netcool/omnibus
1.3. Authority problem
Add the current user to / etc/cron.d/cron.allow and make sure there is no current user in / etc/cron.d/cron.deny. If there is no cron.allow file, create this file with the root user.
1.4. The problem with FIFO
1. To kill the cron process first, you can use ps-ef | grep cron to get the id number, kill-9 PID
2. Rm / etc/cron.d/FIFO
3.. / cron start
On how to carry out Solaris crontab environment analysis is shared here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.