One of surely many future little posts about nifty commands I've found through wandering around trying to learn how to do stuff.
I Was trying to figure out how to send a command to my server via ssh that would continue to run after I logged out.
Super simple, right?
Well, I had a hell of a time getting it to keep going after I logged off. I believe I was doing some other stuff wrong, but it was frustrating when you don't understand much of what you're doing, yet you're doing it anyway!
Long story short, I learned of a few commands:
at
cron
nohup
at is for scheduling specific commands at a certain time. You can use it to perform a command at a later time. I couldn't get this to work, but I realized that it wasn't what I wanted anyway. It does seem rather interesting though, you just type at 12:00 and it'll prompt you to enter commands that it will perform at that time. hint: you end the list with ctrl-d. the time can be anything: now + 1 hour , teatime , midnight + 10 minutes .
cron is like at, but it keeps a list and performs them routinely. it works by making a schedule of commands to run at specific times at specific intervals. I didn't look into this at all, because I only wanted to run this one command once.
nohup stands for "ignore hangups" ... somehow. It ignores the minor detail of you logging off and allows the command to continue to run unabated. I had some weird issues with this, but I believe it was just a sudo or something that I needed. It also might have been a space issue, since I wasn't paying attention to where I was running this command.
essentially, I settled on nohup for the task at hand, but I'm sure I'll come across a need for the others.
the command in question? downloading a large torrent, of course:
sudo nohup btdownloadheadless highlyImportantTorrentFile
silly, I suppose, but I learned some stuff from it.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment