What's new

nohup does nor work, am I doing something wrong?

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Bamsefar

Senior Member
So I am trying to run a script all the time, it is a simple thing just checking if a mobile is connected to wifi. It works as long as I am online (with putty). Logout and it stops direct.

So I start with:
nohup /bin/sh /jffs/scripts/CheckIfHome2 &
Am I doing something wrong here or is nohup broken?

I'm using AC3200 with rMerlin 378.55.
 
nohup didn't work for me either. The Entware-ng repository has an app called 'screen'. Setup Entware-ng, then:
Code:
opkg update
opkg install screen


Running Screen

Then, to use it, type...
Code:
screen sh

It will open another terminal instance. You can now start a process you want to be able to leave running and reconnect to later. For example, downloading something with get_iplayer.


Detach

To detach this terminal session, press

CTRL + A release, and then press D

Then you are back in the original terminal screen with the other one running detached in the background.


List all Instances

You can list all open screen instances and their status by typing…
Code:
screen -list


Reconnect

...and you can reconnect to an instance with...
Code:
screen -r



SOURCE: http://raspi.tv/2012/using-screen-with-raspberry-pi-to-avoid-leaving-ssh-sessions-open

 
screen is a good workaround, but nohup seems to be broken/missing in the default busybox implementation.

Alt approach would be to install the bash shell from entware, and then nohup should work fine...
 
nohup isn't working for me either -- RT-AC68U 380.63

I think it used to work about a year ago, but needed it again this week and it basically kills my process when I logout. I don't want to install opt ware or entware -- is there an alternative ?
 
Last edited:
I suppose one could get really weird and wrap the script in a loop...

while true; do thescript.sh; done

;)
 
I suppose one could get really weird and wrap the script in a loop...

while true; do thescript.sh; done

;)
Just loose the &, otherwise this would be kind of a perpetual "machine" ...
 
instead of a script that runs continuously, set it to run every minute in the router's crontab.
use cru for that.
Code:
ramon@ac66u:/tmp/home/root# cru --help

Cron Utility
add:    cru a <unique id> <"min hour day month week command">
delete: cru d <unique id>
list:   cru l

now you can let your script run and exit, and check the exit status/code.
this will allow you to take actions based on the failure/success of your script.
 
The nohup seems doesn't work but these way could do it:
Using this command in computer, no ssh login and my_custom_script.sh keep running in background:
Bash:
ssh admin@192.168.1.1 "/jffs/my_custom_script.sh &"

Tested on Merlin 386.2_4

btw: this command can write log into webUI

Bash:
logger -c -p user.info "my custom text"
 

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top