Ottavio Caruso <ottavio2006-usenet2012@yahoo.com> writes:
Hi,
LAP1 is a Thinkpad that I use only at home as a poor man's desktop.
LAP2 is a second Thinkpad that I use mainly outdoors, on which I run
an SSH server to do some syncing every now and again.
Both using latest Debian stable with similar sets of apps.
At night, I want to connect to LAP2 and perform these commands:
$ sudo tlp setcharge 90 95 BAT1 # resets battery settings for external
battery
$ hibernate.sh # a script that performs some housekeeping, puts laptop
into hibernation and eventually disconnects sshd.
From LAP1 I can issue:
$ ssh LAP2 sudo tlp setcharge 90 95 BAT1 # it works
or:
$ ssh LAP2 hibernate.sh # it works too
but either:
$ ssh LAP2 "sudo tlp setcharge 90 95 BAT1 && hibernate.sh"
or
$ ssh LAP2 "sudo tlp setcharge 90 95 BAT1 ; hibernate.sh"
return:
hibernate.sh: command not found
your shell interpret this as two commands
1. run "sudo tlp setcharge 90 95 BAT1"
2. then run "hibernate.sh" (without sudo)
you can try
--8<---------------cut here---------------start------------->8---
ssh LAP2 "sudo tlp setcharge 90 95 BAT1 ; sudo hibernate.sh"
--8<---------------cut here---------------end--------------->8---
or
--8<---------------cut here---------------start------------->8---
ssh LAP2 "sudo sh -c 'tlp setcharge 90 95 BAT1 ; hibernate.sh'"
--8<---------------cut here---------------end--------------->8---