Making scripts runs on backgourd and logging output

nohup exemplo.sh &
Sample Output
The output errors will be logged in nohup.out file.

-1
2015-08-31 18:28:08

1 Alternatives + Submit Alt

What Others Think

I don't understand, someone votes down and don't leave any comment for the reason of negative mark? The command works perfectly!!
andregyn62 · 272 weeks and 4 days ago
I didn't vote one way or another. You use the command nohup (a command immune to hangup signals) so the command will continue to run when you logout, but you usually you just need to put the command in the background with an & and it will keep running after you log out. I believe this is the default setting on most Linux distros and to be honest, I'm not sure where you set that. That is something I should look up for my own knowledge. Anyway, the alternatives provide more options for logging. I think you're just saying that if your script does logging it isn't going to stop if you run it this way? The tee example just writes to a file, so whatever is happening while you're logged out will be readable in the log file.
sonic · 272 weeks and 1 day ago
Yes, u are right, but the nohup command create a log file called nohup.out, where is logged the output of command/script if have any output. But u command is cool.
andregyn62 · 271 weeks and 3 days ago
Yes, u are right, but the nohup command create a log file called nohup.out, where is logged the output of command/script if have any output. But u command is cool.
andregyn62 · 271 weeks and 3 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: