I am trying to run a command. This is one of my attempts:
This works, and I see the directories. However, what I want to do now is start a process on the remote server such as
works fine on the remote server once I log in and run it. It even stays running when I logout.
But I can't get it to run when I use the sudo command with ssh. I've tried to use the following:
and
it does not output anything, it appears to login to the remote server but I never see the command running. What would be the best way to get this command to run with the very simple script above?
This is my latest attempt:
This works, but as soon as I control -C (it gets stuck) the process dies on fileservera
Anyone have any idea?
I now tried to enclose with
this works but it disconnects me at the end and the process dies in 30 seconds and does not keep alive
Also I have about 100 hosts with different Solaris/Linux so it is hard for me to use screen
Last edited by newbie2010; 09-24-2015 at 04:55 PM..
In two of your examples you have a typo 'sudo/usr/bin/connectproc.
You can leave the ssh session connected by calling ssh with a -f flag to background as soon as it's finished authentication.
If you want to cleanly and reliably start the process running then disconnect the ssh session from it, protect your commandline from inline interpretation by pushing a small script up first, then calling it:
littlescript.sh:
Hello,
I am running a python file from terminal and I wish to see which code is running at background. When I use htop, I see just a few commands, unable to see entire command.
htop > report
nano report
Output:
^
Following parts of ffmpeg line is not shown by htop. Just showing... (7 Replies)
I tried to run the following commands in my shell script.
This command works fine for me:
ssh -n "${username}"@"${hostname}" "grep WARNING ${serverhome}/${serverlog} | wc -l"
The result is:
1548
However when i try to run a similar one:
ssh -n "${username}"@"${hostname}" "test `grep -q... (2 Replies)
Hello,
I know for SSH'ing and running a local script is...
ssh -t user@servername < /path/to/localscript.sh
and with SSH'ing and SUDO'ing is...
ssh -t user@servername "sudo -u username ls -l /home/username"
My inquiry is how can I combine both, by SSH'ing and SUDO'ing but running... (4 Replies)
Hi All,
I am trying to run my script using ssh. Below is the code snippet
#!/bin/bash
ssh username@useipapd03 'bash -s'
#To ensure If JMSdirectory exists or not
if
then
echo "JMS mounts................exist'>>OutputResult.txt
else
echo "JMS mounts................not... (10 Replies)
hi all
i am running following command
ufsdump 0ubf 512 /dev/rmt/0cbn /database/backup2/rman_backup/level1 >> /database/backup2/backup_tape/level1_rman_03aug12 2>&1;
i want to run it in background how can i do it
in this i am generating logs for backup.
the problem occurs when i am... (3 Replies)
Hello,
I am trying to find a way to send several sequential commands via SSH to a remote box in a single command.
Thoughts so far:
1) Can I put them into a function and call the function within the ssh command?
e.g.
ssh <targetserver> $(functionx)
No - then it calls the function in... (4 Replies)
Hi ,
I want to see all the background process that are running in unix box machine...please guide me is there any specific command for that..since I am executing some scripts at background..!!:confused: (1 Reply)
I am writing a BASH script to update a webserver and then restart Apache. It looks basically like this:
#!/bin/bash
rsync /path/on/local/machine/ foo.com:path/on/remote/machine/
ssh foo.com sudo /etc/init.d/apache2 reloadrsync and ssh don't prompt for a password, because I have DSA encryption... (9 Replies)
I have a command running in the foreground (and so my term window is locked up) and I want to kill it, then resume it in the background and go home. It is creating a zip file, and the file will be written to the current directory - no std in / std out issues.
How do I do this? Kill it with a... (3 Replies)
Here is the command I want to run:
for pkg in `pkginfo | grep -i VRTS | awk '{print $2}'`; do showrev -p | grep $pkg; done | awk '{print $2 "\t" $7}' | uniq
It returns the package info in a form such as:
113210-03 VRTSfspro
112392-06 VRTSvmman
113596-03 VRTSvmpro... (1 Reply)