exec-checked-script with a single command

23 views
Skip to first unread message

Roman Scherer

unread,
May 6, 2013, 9:11:30 AM5/6/13
to palle...@googlegroups.com
Hi Pallet Users,

I'm converting my pallet cartes to the 0.8 version and get some
strange behaviour. I'm not sure if this is a bug or if I'm doing
something wrong.

In my configure phase I want to restart a service and then check
if it is running on a port. So I did this:

(defplan verify []
  (wait-for-port-listen 9000 :max-retries 15))

(defplan restart []
  (exec-checked-script
   "Restarting service"
   ("/etc/init.d/myservice" "restart")))

(defplan configure []
  (restart)
  (verify))

The problem is that the "restart" command doesn't appear in the
shell script that is getting executed on the target machine.

Adding an additional command, like "sleep 5" solves the
problem. Then the command appear in the shell script.

(defplan restart []
  (exec-checked-script
   "Restarting service"
   ("/etc/init.d/myservice" "restart")
   ("sleep" "5")))

Is this a bug, or am I doing something wrong here?

Thanks, Roman.

Ryan Stradling

unread,
May 6, 2013, 1:18:36 PM5/6/13
to palle...@googlegroups.com
I believe I know what is going on.  There is a bug reported about this.

https://github.com/hugoduncan/clj-ssh there is some topics for further investigation.  The basics are due to how currently ssh is run with the -t option that depending on your init script you could background something and the ssh thinks you are done.

A workaround for now is
(crate/defplan restart-memcached                                                                                            
                                [& {:keys [instance-id]}]                                                                                                 
                                (exec-checked-script                                                                                                      
                                  "Restarting memcached"                                                                                                  
                                  ("set" "-m")                                                                                                            
                                  ("service" "memcached" "restart"))) 

Thanks,
Ryan
--
You received this message because you are subscribed to the Google Groups "pallet" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pallet-clj+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Hugo Duncan

unread,
May 6, 2013, 1:31:30 PM5/6/13
to palle...@googlegroups.com

Roman,

I've tried to reproduce this using pallet.clj

https://www.refheap.com/paste/14220

I see the restart being run.

Normally this behaviour would indicate the first, string, argument to
exec-checked-script was missing.

Hugo

Roman Scherer

unread,
May 7, 2013, 6:53:59 AM5/7/13
to palle...@googlegroups.com
Hmm, I have the first string argument. Maybe something else in my chain 
is eating up my command. I'll dig into it a little bit further ....
Reply all
Reply to author
Forward
0 new messages