How to close program 1 hour after startup?

Hi all,

I am seeking for a solution how I can start my Thunderbird on startup and close it after 1 hour automatically.

The reason being is that I use Thunderbird to synchronise and backup my email accounts but it's enough for me to run it only for one hour after startup each day.

Any ideas how I could accomplish this?

Thanks!

[quote=“orschiro, post:1, topic:13298”]Any ideas how I could accomplish this?[/quote]Well, one somewhat crude way to kill it after an hour is to have a script like this:
#!/bin/sh sleep 1h killall thunderbird
and then launch that script at boot. Be sure to replace thunderbird for the actual task’s name (see system monitor for that). If the killall isn’t honored, you could change it to killall -KILL thunderbird, which will force the kill (but is even more crude).

Alternatively you can use the timeout command:

2 Likes

Or maybe you could run it as a cron job, never used cron myself, but it seems like this could apply.

With Crontab you can specify a command or script to be executed on a certain day of the week, a certain month of the year, a certain day of the month, a certain hour of the day, and a certain minute of the hour, but to the best of my knowledge it will not kill a program 1 hour after it launches.

1 Like

timeout 15s thunderbird will launch Thunderbird and kill it 15 seconds later. So timeout 3600s thunderbird should launch Thunderbird and kill it one hour later.

Edit: This works as a startup program in Ubuntu Mate 17.04

2 Likes

Thanks for all your responses. I decided to go for @steven simple timeout solution. :slight_smile: