Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to apply Crontab of Solaris 10

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

In this issue, the editor will bring you about how to carry out the Crontab application of Solaris 10. The article is rich in content and analyzes and describes it from a professional point of view. I hope you can get something after reading this article.

It is very smooth to use crontab under linux without any problems. You can add tasks directly to crontab-e, but some problems are encountered under Solaris and the specified tasks are not carried out as planned. After the problem is solved, briefly summarize the usage of crontab under Solaris:

A, add operation

Bash-3.00# vi / var/spool/cron/crontabs/root

* / export/home/test/analysisTNS/DCSMonitor.sh

B. Delete FIFO, otherwise cron cannot restart

Bash-3.00# rm / etc/cron.d/FIFO

C. Kill the existing crontab process

Bash-3.00# ps-ef | grep cron

Root 308 1 0 11:09:58? 0:01 / usr/sbin/cron

Bash-3.00# kill-9 308

D. Restart the crontab process

Bash-3.00# / usr/sbin/cron

E. View crontab log

After starting correctly, you can see the following message:

! * * cron started * * pid = 2631 Mon Jun 7 14:29:24 2010

> CMD: / export/home/test/analysisTNS/DCSMonitor.sh

Root 2637 c Mon Jun 7 14:30:00 2010

< root 2637 c Mon Jun 7 14:30:00 2010 f、Solaris定是脚本 # !/bin/bash check_service() { # if return 0, service exist in system # else, service not exist in system mainprocess=`ps -e | grep analysis` # in linux, i use mainprocess=$(ps -e | grep analysisTNS) if [ -z "$mainprocess" ]; then return 1 else return 0 fi if check_service; then echo "service tns is running now" else cd /export/home/test/analysisTNS ./analysisTNS >

/ dev/null 2 > & 1 &

Echo "start tns success"

Exit 0

After completing the above, you can see that the assigned task is carried out as planned.

The script uses ps-e | grep analysis instead of ps-e | grep analysisTNS to check the process, because I find that even if the process is executing, there is no output using the latter, and the process information can be detected using the former, as follows:

Bash-3.00# ps-e | grep analysisTNS

Bash-3.00# ps-e | grep analysis

2641? 0:00 analysis

Of course, using ps-ef | grep analysisTNS can detect the process, but at the same time, the grep command itself is also detected, and it doesn't work well with-v. Solaris is really a little different.

Bash-3.00# ps-ef | grep analysisTNS

Root 2641 1 0 14:30:00? 0:00. / analysisTNS

Root 3214 830 0 15:24:08 pts/2 0:00 grep analysisTNS

And I haven't found this under linux, it's strange!

The above is the editor for you to share how to carry out the Crontab application of Solaris 10, if you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report