Nohup With Busybox httpd

Nohup is a command that allows you to run another command in the background, even after you log out of the terminal. It is often used to run long-running processes without being interrupted by a terminal session ending.

Example Usage

nohup busybox httpd -f -p 8080 &

This command starts a simple HTTP server using BusyBox’s httpd command, serving files from the current directory on port 8080. The -f option runs the server in the foreground, and the & at the end puts the command in the background.

Check if the server is running

ps -ef | grep httpd

If you need to stop the server, you can find the process ID (PID) and kill it:

sudo kill -9 1193

To run the server in the background and ensure it continues running after you log out, you can use the nohup command:

nohup busybox httpd -f -p 8080 &

Conclusion

Using nohup with BusyBox’s httpd command allows you to run a lightweight HTTP server in the background, making it useful for serving static files or testing purposes without needing a full-fledged web server. This is particularly handy in resource-constrained environments or when you want to quickly set up a simple web server without additional dependencies.

Note

Make sure you have BusyBox installed on your system. You can check if it’s installed by running

busybox --help