The TSM in ESXi is a Posix like environment and much of it resembles and behaves much as you would expect the old RHEL based service console to. That said, some of it is very different too. Today, I figured out that while it may not have all of the features I’m used to (screen), it does have some useful multi-task from single console functions. That is, it has “Jobs” support.
Each task you execute on the CLI is a “job” for the system. Most times these will be fairly quick, ls, esxtop, esxcfg-something, and such. However, if like me you are attempting to move a relatively large set of files from the CLI, and still want to use the system for other things… that’s where jobs come in.
Basic Job Management
- Ctrl + Z – Suspend a task
- bg – execute the last suspended task in the background
- fg – bring the last task back to the foreground
- jobs – lists running jobs & job id
- bg/fg $jobid – Same as above, $jobid is specified when you have multiple jobs going
/vmfs/volumes/4cb08ee3-9aabb1c8-c722-002170bd4485 # mv ./* /vmfs/volumes/ix4-200d-nfs/ -f
 + Stopped (signal) mv ./* /vmfs/volumes/ix4-200d-nfs/ -f
/vmfs/volumes/4cb08ee3-9aabb1c8-c722-002170bd4485 # bg
 mv ./* /vmfs/volumes/ix4-200d-nfs/ -f
/vmfs/volumes/4cb08ee3-9aabb1c8-c722-002170bd4485 # jobs
 + Running mv ./* /vmfs/volumes/ix4-200d-nfs/ -f
What you’re looking at in the above example, is my executing the move command, then suspending it (“Stopped”). Next I execute bg to get the task running again in the background. Finally you see where I launch “jobs” to get the status.
Normally you’d not be running day-to-day ops from the ESXi TSM, it’s nice to have jobs support handy when you need to do some heavy lifting.
As a side note… I wonder how much spam I’ll bring in by mentioning vSphere and Jobs in the same post. Photo by this guy.