Will a Perl script still run after I log out of my user account?

Solution 1:

Yes, this is dead easy to test. Write a perl script that appends the date to a file every minute, and run it in the background. Log out, wait 5 minutes, log in, check for 5 entries corresponding to the times you are logged out. To get it working in future (too late if it's already running) use nohup as explained in another answer. You can background a foreground script after you start it (CTRL-Z) but you can only nohup it at execution

Solution 2:

In addition to @stuffe's answer, if you are logged in via ssh and run your command, it will die when you close the connection. So, if you were at home and ssh'ed into your office workstation and executed your perl myScript.pl & command, it would die when you exit'ed from the ssh connection.

To avoid this problem, you'll want to use the nohup command, which dates back to the teletype days and stands for "no hangup" --- essentially it causes the command to ignore the POSIX HUP (hangup) signal. It is used as:

nohup perl myScript.pl &

This will keep running on your office workstation even after you have disconnected/logged out from your home machine.