Unix Job processing
I learned something new from my brother the other day about unix job processing. We had written a script to do some specific analysis of the logs for dealazon.com, and it would take about 30 seconds to a minute for the script to complete.
I had known for quite some time that you can run a script in the background by appending an
& to the end of your command, for instance:
$> ./some_slow_script.pl &
I often run scripts that take a while, but forget to append the
& so they run in the background. Well it turns out you can hit
Ctrl+Z this will pause the process that is currently running, and give you a shell. Now you can type
bg to send that process into the background. Now you can use the
jobs command to see how its doing, or the
fg command to send it back into the foreground.
So for example you might do something like this:
$> ./some_slow_script.pl hits Ctrl+Z + Stopped ./some_slow_script.pl $> $> bg + ./some_slow_script.pl & $> jobs + Running ./some_slow_script.pl & $> jobs + Done ./some_slow_script.pl
- The 15 Essential UNIX commands - July 29, 2005
- Why is my cron.daily script not running? - January 10, 2018
- Shell Script for backpack todo lists - August 20, 2005
- Burst Throttling on AWS API Gateway Explained
- How to Resolve Java HTTPS Exceptions
- Tomcat Java 10 on Windows CreateJavaVM Failed
- SameSite Cookies with IIS
- Facebook API Now Requires Review for user_friends Permission
- Docker Container exited with code 137
- Why is my cron.daily script not running?
- Announcing FuseGuard Version 3