i need some guidance from all you smarties out there on the fedi.
i have headless #debian server.
no remote root login, but sudo user is available.
trying to run "shred" command on a few HDDs.
obviously this is a very time consuming process.
how can I initiate this process via #SSH and logout of the pty without killing the shred process?
i am also okay with the dd command. my problem is just how to start the process and be allowed to logout/turn off my laptop/etc and keep the process going given that the parent process is my user shell.
@benda depends on the shell, but looking into the `disown` builtin is probably the starting point you need here
edit: or the `nohup` command
@brhfl someone else suggested nohup. ill look into both, thank you!!!
@benda yeah nohup is the smarter choice since you know ahead of time that you need it to run independently… disown is the answer for people like me who a: use job control and b: have no foresight
@geillescas reading the man right now, seems simple enough, thank you for your guidance
@benda You could use a sceen/tmux session and detach it
@llutz this is so far the popular solution. thank you very much
@benda
If you have screen or tmux, start the operation from within the screen, detach, logout.
SSH back in and reattach to the screen periodically as your ocd triggers....
@mad_asshatter ooooh i like a solution that allows for ocd triggers :)
appreciate you comrade
@benda screen and tmux are very helpful too
@benda
Try screen
screen -dmS yourdesiredpname /bin/bash -c "yourlongrunningcommand"
Bring the process to foreground
screen -r yourdesiredpname
@flan it seems democracy has spoken. you're the third to recommend screen. i appreciate the exact commands!
GNU Screen should do it :)
@prozacchiwawa these seem to be the popular solution. thank you so much for your reply
@benda you can run screen or tmux, there are cheatsheets online about shortcuts. In short it's a "detachable" terminal, next time you login you run `tmux attach` or `screen -r` to reattach, no sudo required
@duckz tyvvvm looking into rn
@benda I'm not a pro. I think you could setup this as a chron job, which will execute without anyone being logged in. Yes, maybe it's a one time run, so tell chron to run AT now + time offset, or similar with a script. So, when you SSH, you'll setup the chron job, confirm, and then log out.
@benda very awkward and unpopular idea: write a systemd service file for it and start it
@r0b0 thats the kind of idea i love lol
but maybe when i have less projects on my plate
@benda if you're using systemd, make sure the account you're using is allowed to have jobs linger after logout, or it'll kill nohup/screen/tmux when you log out (Debian might default to that, idk)
https://docs.oracle.com/en/operating-systems/oracle-linux/8/obe-systemd-linger/
@igrok ooooh VERY good looking! indeed i am using systemd. i really appreciate that advice
@igrok @benda Alternatively, look into `systemd-run` which is systemd's way of running a job that is not attached to your login/shell, and is meant to replace `nohup` for the "running a process that survives logging out" use-case on systemd systems.
https://manpages.debian.org/bookworm/systemd/systemd-run.1.en.html
@aspragg @igrok okay so i landed on some combination of systemd-run and screen. now the only weird thing is that i have "6 screens" but I can't switch back to 4 of them lol. THANKFULLY i have shred running on shell 0 of window 1 and i can keep going back to check on as needed, i have tested logging off the server and back in. but i dont know where these other 4 screens are and how in god's name to switch to them and kill them.
@aspragg they're already attached! according to screen anyways (you can see in the right hand column of the above output). i just can't seem to find most of them. the only window seems to be window 1 (which is where I am) with two screens, number 0 and 1. 0 being the ongoing shred command and 1 being the available terminal line shown above.
@aspragg AH!! but your command is working in killing off the mystery screens! thank you sooooo much!!