Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto create screen at startup #1

Open
Ashaxer opened this issue May 13, 2024 · 0 comments
Open

Auto create screen at startup #1

Ashaxer opened this issue May 13, 2024 · 0 comments

Comments

@Ashaxer
Copy link

Ashaxer commented May 13, 2024

Hi. since I am using my servers for other purposes too, I reboot it frequently, so I made a piece of bash command to create a crontab schedule to start an screen at every startup of my server.

This code creates an screen with name lava and starts the task:
screen -dmS lava sh -c 'cd /root/lava-farmer/ && go run main.go'

This code is supposed to be added to crontab schedules like this:
crontab -e
and adding this to the file and save:
@reboot screen -dmS lava sh -c 'cd /root/lava-farmer/ && go run main.go'

And this final code automatically adds the above code to crontab schedules all at once:
{ crontab -l -u root; echo "@reboot screen -dmS lava sh -c 'cd /root/lava-farmer/ && go run main.go'"; } | crontab -u root -

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant