Can we run SUA command under Windows the task scheduler ?

While working on a cron job issue, one of the customers wanted to know if they can run the SUA command through a task scheduler instead of cron job. Below are few steps which we can run from the korn/C shell on a system which has subsystem for Unix installed along with SUA SDK package.

  • crontab –p ==>(enter the password for the domain user)
  • crontab <cronjob file> ==> ( to run the cronjob)
  • crontab –e ( to edit) ==> to edit the cronjob)

 

Now, regarding the question of running SUA commands through task scheduler, yes we can run it. The syntax which you need to put on a notepad is:

“c:\WINDOWS\posix.exe /u /c /bin/ksh -l -c /dev/fs/C/Windows/SUA/bin/ls > c:\test.txt”

The above command will run the ‘ls’ command and dump the output to C:\test.txt. Similarly, one can tweak the command as per their requirement.  Once done, we need to save the notepad as somename.cmd (.cmd is a must).

The open the task scheduler (Programs ==> Accessories ==> System tools ==>Task Scheduler

The under the Actions tab, select the appropriate .cmd file and start the task schedule.

 

More inputs on task scheduler can be found in:

https://support.microsoft.com/kb/308569

https://technet.microsoft.com/en-us/library/dd851678.aspx