Process stops after inline script is done via Vagrant
Currently you running the script but its executed as root
user so all the lines are added for this user only. You want to use the privileged
option
privileged
(boolean) - Specifies whether to execute the shell script
as a privileged user or not (sudo
). By default this is "true".
you will want to run the script with the vagrant user so you can change to
config.vm.provision "shell", inline: "/vagrant/scripts/install.sh", privileged: false
You should then use nohup
to keep the script running after the session is stopped
nohup /opt/weblogic/user_projects/domains/custom/startWeblogic.sh &> /home/vagrant/startWeblogic.out&
nohup /opt/weblogic/user_proejcts/domains/custom/bin/startNodeManager &> /home/vagrant/startNodeManager.out&
How to reconnect to a background GUI application after session disconnect?
This seems to be a problematic setup to me. Why not work on the local computer in the first place? But if you want (or have to) to work on the server, better start the desktop directly on the server via XDMCP, VNC, or Citrix XenAPP (commercial).
EDIT: Just found this article about xmove. I haven't heard about it before, but maybe it works.
How to fix issues with 'The SSH connection was unexpectedly closed by the remote end'?
Open your /etc/ssh/sshd_config
file:
# vi /etc/ssh/sshd_config
Modify setting as follows:
ClientAliveInterval 30
ClientAliveCountMax 5
Where,
ClientAliveInterval: Sets a timeout interval in seconds (30) after which if no data has been received from the client, sshd will send a message through the encrypted channel to request a response from the client. The default is 0, indicating that these messages will
not be sent to the client. This option applies to protocol version 2 only.ClientAliveCountMax: Sets the number of client alive messages (5) which may be sent without sshd receiving any messages back from the client. If this threshold is reached while client alive messages are being sent, sshd will disconnect the client, terminating the session.
Close and save the file, then restart sshd
, e.g.:
# /etc/init.d/ssh restart
or:
# service sshd restart
Another option is enable ServerAliveInterval
in the client’s (your workstation) ssh_config
file, e.g.
# vi /etc/ssh/ssh_config
Then append/modify values as follows:
ServerAliveInterval 30
ServerAliveCountMax 5
Where,
ServerAliveInterval: Sets a timeout interval in seconds after which if no data has been received from the server, ssh will send a message through the encrypted channel to request a response from the server.
In above example, ServerAliveInterval
is set to 15 and ServerAliveCountMax
is left at the 3, if the server becomes unresponsive, ssh will disconnect after approximately 45 seconds. Again this option applies to protocol version 2 only.
Keep SSH Sessions running after disconnection - for overnight
Run the screen on the server (as opposed to on the client, which is what you seem to be doing right now). This way, MATLAB can write output even if you are not connected to the server via ssh. The order of commands for this is ssh, screen, matlab. If you want to resume your session, just connect to the server via ssh, then run something like screen -x
Debian: SSHing and running a process that won't die if SSH connection is closed
Repeating myself, but I am writing an answer so it can be marked as accepted/solved :)
Learn about screen and/or tmux! You won't regret it. tmux is newer and better. stackoverflow.com/questions/70661/what-is-gnu-screen
screen/tmux let's you keep a remote terminal session running that you can connect/reconnect to - I always start long running tasks in a screen in case my connection drops (or in case I wanna leave the office and go home ;) ).
Related Topics
How to Update Minikube Latest Version
How to Make Ssh Command Execution to Timeout
Linux of Equivalent Cryptprotectmemory
Yocto Bitbake Script Not Displaying Echo Statement
Does I2C Driver Need to Be Implemented Just Like Any Other Character Device Driver
Why Does Git Fail on Push/Fetch with "Too Many Open Files"
Docker Run a Shell Script in The Background Without Exiting The Container
What Determines The Order Directory Entries Are Returned by Getdents
How to Convert Fixed Size Dimension to Unlimited in a Netcdf File
Graphing The Dag Generated by Make
How to Find The Reason for a Dead Process Without Log File on Unix
Linux Append Console Output to a Logfile
Implicit Declaration of Function 'Create_Proc_Entry'
Starting Ddd with Remote Gdbserver
Read Serial Data Without High CPU Use
Undefined Reference to Symbol 'Pthread_Key_Delete@@Glibc_2.2.5