Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230
Start a own written program at boot
-
- Posts: 4
- Joined: 2018-09-14 12:14
Start a own written program at boot
Hello,
I am using wheezy as a server (without a Desktop). I wrote a program that I want to start at startup/at boot. This program is actually in my home directory. So please, how can I link it, move it or do it somehow to start it in the boot phase? Thanks.
Regards
I am using wheezy as a server (without a Desktop). I wrote a program that I want to start at startup/at boot. This program is actually in my home directory. So please, how can I link it, move it or do it somehow to start it in the boot phase? Thanks.
Regards
- None1975
- df -h | participant
- Posts: 1389
- Joined: 2015-11-29 18:23
- Location: Russia, Kaliningrad
- Has thanked: 45 times
- Been thanked: 66 times
Re: Start a own written program at boot
Hello. Check this. Maybe you will find this link helpful.
OS: Debian 12.4 Bookworm / DE: Enlightenment
Debian Wiki | DontBreakDebian, My config files on github
Debian Wiki | DontBreakDebian, My config files on github
-
- Posts: 4
- Joined: 2018-09-14 12:14
Re: Start a own written program at boot
Thank you. I thought it would be easy like link it to any runlevel or so
It could be that I be wrong.
It could be that I be wrong.
- GarryRicketson
- Posts: 5644
- Joined: 2015-01-20 22:16
- Location: Durango, Mexico
Re: Start a own written program at boot
Some more details on this "program" would help, is it really a program or
just a script, ?
You might be able to start it using the '/etc/rc.local'
also " init.d " or ' crontab ' are options.
Did you try searching, using these : key words ?
just a script, ?
You might be able to start it using the '/etc/rc.local'
also " init.d " or ' crontab ' are options.
Code: Select all
man init.d
Code: Select all
man crontab
Code: Select all
How to make a program start at boot on Debian 7 wheezy
"What we expect you have already Done"
==========
Old Website
======================
For the Birds
==================
What Does a Parrot Know About PTSD?
==========
Old Website
======================
For the Birds
==================
What Does a Parrot Know About PTSD?
Re: Start a own written program at boot
You can run something from cron at boot from the man page for crontab(5)
You can put this in your crontab file with the command `crontab -e` or in the root crontab by running that command as root.
If you haven't worked with cron before, be aware that it runs the commands with a stripped down environment - not your login environment. For example if your program is ~/bin/command you would need to specify '/home/username/bin/command' in the crontab file. It is also wise to redirect output somewhere you can look at it in case the job doesn't produce the desired results. '>/tmp/command.txt 2>&1` will work for sh or bash shells. I'm afraid I don't recall which shell cron uses to run commands.
/etc/rc.local would be the easiest way but I don't see it on my systems so I don't know if it still works.
You can also configure this using systemd but that takes a bit more work. However it can provide the benefit of restarting your program if it crashes.
HTH,
hank
Code: Select all
man 5 crontab
...
Instead of the first five fields, one of eight special strings may appear:
string meaning
------ -------
@reboot Run once, at startup.
@yearly Run once a year, "0 0 1 1 *".
@annually (same as @yearly)
@monthly Run once a month, "0 0 1 * *".
@weekly Run once a week, "0 0 * * 0".
@daily Run once a day, "0 0 * * *".
@midnight (same as @daily)
@hourly Run once an hour, "0 * * * *".
...
If you haven't worked with cron before, be aware that it runs the commands with a stripped down environment - not your login environment. For example if your program is ~/bin/command you would need to specify '/home/username/bin/command' in the crontab file. It is also wise to redirect output somewhere you can look at it in case the job doesn't produce the desired results. '>/tmp/command.txt 2>&1` will work for sh or bash shells. I'm afraid I don't recall which shell cron uses to run commands.
/etc/rc.local would be the easiest way but I don't see it on my systems so I don't know if it still works.
You can also configure this using systemd but that takes a bit more work. However it can provide the benefit of restarting your program if it crashes.
HTH,
hank
-
- Posts: 4
- Joined: 2018-09-14 12:14
Re: Start a own written program at boot
Hello.
Thank you all.
The program is a script, yes thas true
Until now I tried this: I put a softlink (ln -s) in every runlevel with a "S" letter at start of the name. But it wont worked. I did the same in /etc/init.d, but without success.
I overcome such a problem in former times exactly like that, but the os was ubuntu. Now I want to do this with debian
regards
Thank you all.
The program is a script, yes thas true
Until now I tried this: I put a softlink (ln -s) in every runlevel with a "S" letter at start of the name. But it wont worked. I did the same in /etc/init.d, but without success.
I overcome such a problem in former times exactly like that, but the os was ubuntu. Now I want to do this with debian
regards
- GarryRicketson
- Posts: 5644
- Joined: 2015-01-20 22:16
- Location: Durango, Mexico
Re: Start a own written program at boot
Ok, well, here is one that applies to Bash scripts, and using /etc/rc.local :
https://serverfault.com/questions/73562 ... s-of-shell
If it is not a bash script, but perl (for example), it still could be used, with some
modification.
This might be of help to you as well:
https://debian-administration.org/artic ... ith_Debian
https://serverfault.com/questions/73562 ... s-of-shell
If it is not a bash script, but perl (for example), it still could be used, with some
modification.
This might be of help to you as well:
https://debian-administration.org/artic ... ith_Debian
"What we expect you have already Done"
==========
Old Website
======================
For the Birds
==================
What Does a Parrot Know About PTSD?
==========
Old Website
======================
For the Birds
==================
What Does a Parrot Know About PTSD?
-
- Posts: 4
- Joined: 2018-09-14 12:14
Re: Start a own written program at boot
please be aware that wheezy has been outdated & EOL for a long while now.
you really should upgrade.
in any case, no solution involving systemd will work.
you really should upgrade.
in any case, no solution involving systemd will work.