I need to keep a process running in my terminal connected to my QNAP TS-131P NAS. Problem is: if I close my terminal window, the process obviously stops. I tried all methods suggested in this message, but none of them work because the utilities used are not installed on the NAS (e.g. nohup, screen, tmux are all missing)…
So, I’m in a dead-end…How can I start and keep a process running even after closing the terminal in my QNAP NAS?
Are you sure? I’ve abandoned SSH sessions (not logged out, just closed the window) and I thought the process continued. I could be wrong, I know this is the case for a different brand NAS that I also have.
Is this a regular task that you run? Could you make it part of the system crontab instead of running it manually?
Have you also tried running it in the background and disowning it?
Thank you. As I said in my original message, it is not included on my QNAP NAS. When I type screen, I get a “Command not found” error message. However, I managed to install tmux and it should solve my problem.
Yes, it must be run in the background 24/7. It’s a script that polls a server every 15 minutes to keep a connection alive. It’s a bash script that keeps alive the port forwarding functionality of a VPN server, it was provided by a VPN server company.
No, because I need the initial output of the bash script, as it returns the port number given by the remote VPN server. The cron tab doesn’t provide the output of the script, it just runs it. Additionally, every time this script is run, it returns a new port number, and I would have to change port number in my endpoint application accordingly every time (which wouldn’t be manageable).
I haven’t but I’ve bookmarked this page you gave. If needed, I’ll look into it. I was able to install Entware-Std, which ships with tmux. I’m currently trying it, and it seems it’s finally working. Thank you.
Thank you. It could, but I think I won’t have to, as I managed to install Entware-Std (the manual qpkg installation). It has a tool called tmux, and it seems to be working fine running my script even after closing the terminal
Are you logged-in through SSH as the original admin user, or a user you’ve created? If you’re using a secondary account, you’ll need to prefix many commands with sudo.
If you configured the script correct it can provide an output. I am running several scripts per cron, writing an outout in a log file and/or sending the output by mail.
So I am always aware if something changes or does not act as expected.
“< /dev/null” disconnect the console for input from the bash script
”> /dev/null” disconnect the console for output from the bash script
”2>&1” disconnect the console for error mesages from the bash script
”&” puts the script in the background.
That’s what nohup basically does.
I tested this on a TS-851 QTS 5.2.8.3350 Build 20251216 I own.
Hi, I had great expectations with tmux, but after a day, it would stop working. I installed nohup last week, and to date, it hasn’t stopped working. This is how I did: