Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I would like to execute commands on a remote desktop machine, but SSH would be difficult since the remote is offline most of the time, resides in a time tone 10 hours from mine, and may often be behind a firewall / NAT with an unknown IP. So it will have to pull my commands when it can. I am thinking of something around curl http://.../do.sh | bash just kidding.

Are there tools available that support such a thing?

I am looking for

  1. Something simple and reasonable stable
  2. for Linux
  3. that pulls commands securely from a web address, mailbox, etc,
  4. does require some form of authorization, of course (for example, does not execute anything unsigned)
  5. that reports standard output and standard error, and maybe the exit value back to me.

I could provide a server with HTTPS, valid certificates, even sshd if necessary. I think I am able to hack something myself in theory, but I am afraid that would be really time-consuming.

A similar question was asked before, but not really answered (use procmail & code yourself; use our powerful commercial tool for 250$).

share|improve this question

3 Answers 3

It's not that silly (the ssh idea), and could easily enough be implemented if a) the machine that serves ssh up is on-line and b) remains reachable by the same name/IP at all times. You can easily enough script ssh to authenticate password-less for a given user (daemon?) account, pull a file, and then act upon it. I don't think that this is in the too-hard (or too time consuming) basket.

share|improve this answer

You can also think about using a git or svn repository and use post-hook. For example :

  1. Client modify a file with a list of command or a bash script to execute
  2. Client push modified file to remote server (server that is online most of the time -- use bitbucket or github or any git/svn service provider)
  3. Server when logged in execute a git merge/svn update
  4. With a git merge hook or svn post-update hook trick

It's not so hard and it can be a way to handle the offline state of your server.

share|improve this answer

I'd look at something like cfengine or puppet - they're designed to run commands on remote servers, and log the result.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.