[Novalug] bash scripting

Miguel Gonzalez Castaños miguel_3_gonzalez@yahoo.es
Fri Jun 1 17:56:45 EDT 2007


Jeff Stoner escribió:
> On Fri, 1 Jun 2007, [ISO-8859-1] Miguel Gonzalez Castaños wrote:
>
>>
>> I want to launch a command using nohup in a bash script, and when the 
>> command has finished send an email with the log file. I prefer not to 
>> have to type nohup script.sh & and be able to wait inside my script.sh :
>>
>> nohup command > log &
>>
>> mail -s "subject" email@address < log
>>
>> I have googled but I can't figure it out
>
> Why not wrap "command" in a script that does the emailing?
>
>
> --Jeff
>
> "I am not available for comment"
Because I don't want to complicate things. This command is part of a 
function, I have two functions and the parameters select whether the 
script is called from cron or cmd line. Cron already runs the nohup for 
me, but as I said previously I prefer not to create two scripts for 
doing something so simple. There isn't a variable that gets the return 
value of a command and that way I can control when the command is finished?

Miguel




More information about the Novalug mailing list