LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   question regarding a cronjob? (https://www.linuxquestions.org/questions/linux-software-2/question-regarding-a-cronjob-943042/)

Ajit Gunge 05-03-2012 02:08 AM

question regarding a cronjob?
 
I have a script say "xyz" it basically sends an automated mail to couple of recepients regarding the status of the server.
This is done through a cronjob.I am not much familiar with the working of a cronjob or how it exactly works.
What I want to find is how often the script is run and from where exactly I mean where is the cronjob located.Further what I want to do is once I receive the mail.I want to check for some conditions from the script and perform some action based on the results in the script.Can someone guide me how can I go about doing this.

pan64 05-03-2012 02:19 AM

Again, would be better if you define your environment in details.
in general there is a process named cron. This runs day and night and will start processes by the configuration.
see man cron about this process, and see man crontab about the config. Users have their own config, so you can start your process when you want. Also cron has a special environment (you can find it in the man pages also), so you need to prepare the environment for your task as well.

Ajit Gunge 05-03-2012 02:58 AM

I am on an AIX machine.I have the script "xyz".Now when I do crontab -e I get all the entries or cronjobs listed.But I dont see the script "xyz" in the list of the jobs.So what I want is something that greps through the entries of the files.Is this possible.I want to grep in the individual files of the output of the crontab -e command just to find exactly from where the script "xyz" is called from.

pan64 05-03-2012 03:17 AM

if you know when it was started you can find it easily, just look for the time in the crontab -e list (if it is not too long). Also you can modify your script to write a logfile about its starting time, parent process and related infos.


All times are GMT -5. The time now is 03:24 AM.