Solved

How to set  script to be auto-launched everyday?

Posted on 2015-01-05
5
165 Views
Last Modified: 2015-01-11
There is some script in a unix machine i need to lauch manually everyday at certain time, it returns a string value, i would like to set up some script to check this automatically everyday and send an email to my address with the result, i know alread how to send the email, but i don't know how to set the script to lauch this other script, get the result and send it to me.
0
Comment
Question by:celtician
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 40532433
see `man 5 crontab`
0
 
LVL 48

Accepted Solution

by:
Tintin earned 250 total points
ID: 40532481
crontab -e

which will put you in an editor, then you add something like

0 23 * * * /path/to/your/script

Where, the first two fields are min and hour, so in this example, the script would run everyday at 11pm
0
 
LVL 40

Assisted Solution

by:omarfarid
omarfarid earned 150 total points
ID: 40533008
If you want to capture script output and based on it decide to send email then you may do the following in the calling script:

1- set env variables e.g. PATH, etc.
2- use full path names to folders and files

The calling script that you use in crontab job, can be similar to:

result=`/path/to/myscript`
case $result in
res1|res2)
                 sendmail -s "email for result $result" username@domain.com
                 ;;
res3|res4)
                 sendmail -s "email for dif result $result" username@domain.com
                 ;;
*)
                sendmail -s "no matching result" username@domain.com
                ;;
esac
0
 

Author Comment

by:celtician
ID: 40533956
Tintin and whats the meaning of the three asterisks after 0 and 23???
0
 
LVL 62

Assisted Solution

by:gheist
gheist earned 100 total points
ID: 40534081
recent vixie-cron says this:

              field          allowed values
              -----          --------------
              minute         0-59
              hour           0-23
              day of month   1-31
              month          1-12 (or names, see below)
              day of week    0-7 (0 or 7 is Sunday, or use names)
A field may contain an asterisk (*), which always stands for "first-last"


Next field is username in /etc/crontab only
then starts command (i.e no username for other crontabs)

always use crontab command line to edit users' crontab.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
NTP Server in VMware 5 387
LINUX ZIP - UNCOMPRESS WINDOWS PATH 3 109
Oracle Finace 3 96
UNIX Script. Send email if failure 8 60
I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question