We can use screen, tmux, nohup command to run process in background.
But, what we can do if we already run the process and we want to send it to background.
We can use kill signal to achieve this.
kill -SIGSTOP PID
kill -SIGCONT PID
SIGSTOP = pause the process SIGCONT = continue the process
Here is example.
sleep-loop.sh
while(true)
do
echo "running loop...$(date +%s)"
sleep 5
done
You can close the 1st terminal after starting in running the SIGCONT in another terminal AND you can also close the 2nd second terminal as well as it’s running in backgroud.(kind of nohup)
Other method using jobs command
Press CTRL + Z to Pause the current process
bg = to send job to background
disown %1
disow will remove form job queue and run in background so that we can close the terminal
One of the issue that i face with my raspberry pi 4 SD card. I removed it when it was in the pi case. Which broke the SD card chip in half internally.
Lesson : Always remove the SD carefully.
broke my 32 GB SD card while removing from Pi. I tried formatting with fdisk, mkfs.ext4 and Windows but none of them worked.
I have attached screenshot of fdisk /dev/sda where I have created 1 partition but when i try to delete the same it’s giving error No partition is defined yet!