Get the App
SLTechnology News&Howtos  ›  Servers  › 

What is the crontab setting example of squid rotate under solaris?

Shulou Source: shulou.com Published: 2022-05-31 15:31:46 09月20日 Update

This article introduces how the crontab setting example of squid rotate under solaris is. The content is very detailed. Interested friends can use it for reference. I hope it will be helpful to you.

Cron is the main scheduling process in solaris system, which can run jobs without human intervention. Crontab commands allow users to submit, edit, or delete jobs. The system administrator forbids or allows users to own their own crontab files through cron.deny and cron.allow files. Cron.allow indicates who can use the crontab command. If it is an empty file, no user can schedule a job. If this file does not exist and there is another file, cron.deny, only users who are not included in this file can use the crontab command. If it is an empty file, it indicates that any user can schedule a job. Cron.allow takes precedence when two files exist at the same time, and if neither exists, only the superuser can schedule jobs.

Recently, a rotation log has been set on the server, and the specific operations are as follows:

# export EDITOR=vi

# crontab-e (can also be modified directly: / var/spool/cron/crontabs/root)

# 00 * * 1 / usr/local/squid/sbin/squid-f / usr/local/squid/etc/squid.conf.external-k rotate > / dev/null 2 > & 1

# 00 * * 1 / usr/local/squid/sbin/squid-f / usr/local/squid/etc/squid.conf.internal-k rotate > / dev/null 2 > & 1

# 00 * * 1 / usr/local/squid/sbin/squid-f / usr/local/squid/etc/squid.conf.reverse-k rotate > / dev/null 2 > & 1

Split the log at 0: 00 every Monday and block the information output.

# wq!

# crontab-l output verifies whether it is edited correctly

# ps-ef | grep cron

# kill-9 324

# rm / etc/cron.d/FIFO

# / usr/sbin/cron

Or stop and restart the cron process through / etc/init.d/crond stop and / etc/init.d/crond start.

The process of this operation is simply explained: first, set the environment variable default editor to vi, if you do not set this, there will be extra numbers when using crontab-e and cannot call the vi editor. Add log rotation setting statements and mask standard output information. Find the cron process and end it, delete the FIFO file (otherwise prompted), and finally restart the cron process.

Note: if you cannot edit the crontab file, please check to see if there is a current user in / etc/cron.d/cron.allow and make sure that there is no account you are currently using in / etc/cron.d/cron.deny.

Finally, do a verification, a week or two or three weeks later to see if there is a split log. As shown in the figure:

On the solaris squid rotate crontab configuration example 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.

Tags: File user job log process content command system output instance two information only at the same time more editor help rotation validation good Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi MariaDB OPPO Reno Docker macOS