Tuesday, 7 August 2012

fg && exit

Found another way to abuse the command chaining...  I had a long running task (e2fsck) running under screen and I wanted to chain some other commands (mount -a && exportfs -rav) but couldn't restart the first command.
  1. Use ctrl+Z to put the job on hold
  2. fg && more commands to bring the job into the foreground again 
  3. Shazzam!
So naturally I put && exit on the end there again to roll out of shell when the command completed.

[1]+  Stopped                 e2fsck -p -f -v /dev/mapper/VolGroup01-project
[root@palmberg ~]# fg && mount -a && exportfs -rav && exit
e2fsck -p -f -v /dev/mapper/VolGroup01-project

1 comment:

Popular Posts