newtask is an important tool when you start applications in a different project context, for example for resource control purposes. May be you may remember my tutorial “Less known Solaris Features: Resource Management - Part 2: How to work with Tasks and Projects”. Heck, it’s over 13 years old now. And the stuff still works.

Sometimes you would like to know the task id of the newly started programs. You can get this information by using the -v option.

root@solaris:~# newtask -v cat /etc/motd

There is just one small problem with this option. The task id is written to stderr.

root@solaris:~# newtask -v cat /etc/sistem
cat: cannot open /etc/sistem: No such file or directory
root@solaris:~# newtask -v cat /etc/sistem  2> test

That makes it sometimes problematic to find out which line is the task id, because it’s not always the case, that the task id is on the first line.

A new option in newtask makes it much easier to use this command in scripts. With -o the newtask command will write the task id into a file.

root@solaris:~# newtask -o narffile cat /var/sistem
cat: cannot open /var/sistem: No such file or directory
root@solaris:~# cat narffile

Yes it’s a small change, but a really useful one.

Written by

Joerg Moellenkamp

Grey-haired, sometimes grey-bearded Windows dismissing Unix guy.