Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to set  script to be auto-launched everyday?

Posted on 2015-01-05
5
Medium Priority
?
169 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 1000 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 600 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 400 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
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…
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…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

721 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