Pausing and resuming process on laptop

Hi, I'm wondering if it's possible to pause a process I'm running in the background, close my laptop (I need to leave the office), and continue the process (when I get home).

I've been running a process for a really long time and I don't want to have to start it over.

Thanks in advance!

For that you have to use a unix command

.
It will run a job even when the system is hung.

Sorry, I'm really inexperienced.

Is that the exact syntax for it? Also, is it possible to just pause the process and then continue it? I'm not sure I have enough battery life for the process to continue running unplugged.

nohup filename 

If you want run the same process in the background. Simply you can use this..

nohup filename &

---------- Post updated at 04:20 PM ---------- Previous update was at 04:15 PM ----------

To stop a process simply you can use Cntrl+z. Then the process will be stopped. In order to restart the process you have to use

or

fg- to run the process in the foreground
bg- to run the job in the background.

If it is interctive, the susp key as shown on stty -a, usually ctrl-Z, takes the job to stoppped. I have not LINUX laptop experience, but I suppose it can sleep or hibernate until you go home and plug it back in, typing fg to get it running again or bg to resume it in the background.

If you launch it with "nohup . . . &", you can log out, but you still need to keep the machine running, and commutes and batteries vary. You can stop that pid with an appropriate kill command option (SIGSTOP?) but I am not sure how you would start it again . . . .

For example You are running a process (or) job,

sleep 50

Now the process is running in the foreground. If you want to stop the process press Control+z..
Then the process will be stopped.

In order to restart the stopped process use this command

fg jobId

It will run the process again in the foreground.
similarly

bg jobId

It will run the process again in the background.

---------- Post updated at 04:30 PM ---------- Previous update was at 04:28 PM ----------

To get the Job Id and Process Id

jobs -l

or

ps

Just to make sure, the job will be held when I close my laptop right? I just don't want it to "forget" it and then have to start all over.

You need a laptop/O/S that does not reboot when you open the lid, just de-hibernates or un-sleeps. My laptops are co owned or too close to diskless to add an Ubuntu boot to see what the power saving support is. Hibernate is a complete copy of RAM to disk so no power is consumed, but the boot has to reinstate the old images and restart job dispatching. Sleep is a low power state where little or no i/o takes place, but RAM is intact under power and the restart is really fast.

Commands 'jobs', 'bg', 'fg' are only good on the parent, launching, interactive ksh/bash (sh?) shell. Batch need not apply. You cannot, to my knowledge, adopt processes of other terminals or none.

Yes.. For that only you have to use nohup command.. Just use nohup followed by filename. The process will be paused in the process table while the system is off.

Nohup just shrugs off the sighup, no other magic is provided.