Find the answer to your Linux question:
Results 1 to 3 of 3
I often run MATLAB on a CentOS server in the background using the nohup command, and the program will often take some hours to finish. Logging on to the server ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Apr 2013
    Posts
    1

    How can I know a command in CentOS has finished remotely?


    I often run MATLAB on a CentOS server in the background using the nohup command, and the program will often take some hours to finish. Logging on to the server remotely and using the top command from time to time to see whether the MATLAB command has finished is a waste of time.
    Screenshot-isaac@localhost:~-Programs.jpg
    It may be better to make the server notify me when the command has finished, so I can just wait and do not need using top to see whether it is finished. I'm running Ubuntu on my PC. Can anyone help me doing this? Thanks a lot.

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,593
    Try the pidof command. It returns the pids of the named program that are running. IE,
    Code:
    pidof matlab
    The pids are printed on stdout. So, you could write a script that runs on the server and each minute checks if matlab is running, writing the date/time to a file when finished. You only need to check if the file is there, and can then check for when it finished. There are many variations on this procedure.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Linux Enthusiast meton_magis's Avatar
    Join Date
    Oct 2006
    Location
    arizona
    Posts
    699
    To expand on Rubberman's suggestion, if you're willing to take the time, you could set it up to send you an email. I do it all the time at work to send me an email when some job finishes, but we have it setup by default there, so it may take quite a bit more effort to get it working in a smaller environment.
    New to the internet, technical forums, or the hacker / open source community??
    Read this to learn good posting habits http://www.catb.org/~esr/faqs/smart-questions.html

    RHCE for RHEL version 5
    RHCT for RHEL version 4

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •