HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Programming/Scripts (http://www.howtoforge.com/forums/forumdisplay.php?f=7)
-   -   I Need To Create a Simple Script (http://www.howtoforge.com/forums/showthread.php?t=54528)

carlosinfl 13th October 2011 19:49

I Need To Create a Simple Script
 
I'm trying to create a Linux shell script that calls the following command:

Code:

/opt/rational/base/cots/flexlm.11.8/i386_linux2/lmstat -a
My question is the above command lists some output that I need dumped into a text file and saved as $DATE_$TIME.txt and then I need the server to email that text file to a specific email address.

My confusion is when I create this Linux bash script, do I need to enter the naming / email information into the script itself or should that be omitted from the script itself and specified in the Crontab line? I've never worked with scripts before so I'm not sure what is proper procedure and such.

falko 14th October 2011 16:21

You can do it one way or the other - that's up to you. I think I'd put this into the script.

nbhadauria 15th November 2011 16:50

hi carlosinfl ,

you wouldn't be needed to create a script for this just use this command and pipe it to a file and mail..

/opt/rational/base/cots/flexlm.11.8/i386_linux2/lmstat -a > lmstat`date +%F_%T`.txt; mutt -s "Output of the Command" -a lmstat`date +%F_%T`.txt emailid@domain.com


and the mail will be send to you at emailid@domain.com you just need to make sure that your server can send the mail to your id..


All times are GMT +2. The time now is 17:25.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.