How do i set a time restriction on an aplication

Hi,

So I’m running warframe through steam on my system and I’m horribly addicted, I like the game but I have more important things to do with my time. I’m trying to find a way to restrict the game from being opened outside of 00:00 - 03:00 (midnight → 3am). I’d also like to forcefully close the game at 3am irrespective of what I’d like to do at the time.

I happen to run blender and godot through steam and I’d need to make sure they arn’t effected by this.

My apologies if this isn’t a suitable place to ask. I’ve just learnt how to bash script using nano, any advise would be much appreciated.

You can try this.

System settings–>Screen and Monitor–>Night Light. Choose Day and Night (1 in screenshot), level down the Night light temperature to 1000K for example (2 in screenshot).

Next click in the settings Day and Night (3 in the above screenshot). Now, in the below screenshot: Use custom hours (1 in the below screenshot), choose the hour to start the night light in your case 00:00 (2 in the below screenshot), choose 1minute to start the night light at 00:01 in your case (3 in the below screenshot), choose the hour to start the day light in your case at 03:00 (4 in the below screenshot).

Is a great change in the visibility of the screen. Not stop the game, but you are aware (I hope).

Regards

what? This is in no ways related to my post

I am only was trying to explain you an alternative that aware you about the hour.

Regards

Or you can try to kill the process (by the name) at the hour you want with at command.

 D     ~/Descargas  zypper info at                                                ✔  22:54:32 
Cargando datos del repositorio...
Leyendo los paquetes instalados...


Información para paquete at:
----------------------------
Repositorio           : Repositorio principal (OSS)
Nombre                : at
Versión               : 3.2.5-3.4
Arquitectura          : x86_64
Proveedor             : openSUSE
Tamaño de instalación : 127,4 KiB
Instalado             : No
Estado                : no se ha instalado
Paquete de fuentes    : at-3.2.5-3.4.src
URL ascendente        : http://blog.calhariz.com/index.php/tag/at
Resumen               : Gestor de trabajos
Descripción           : 
    Este programa le permite ejecutar trabajos a una hora especificada.

Regards

You could create a script that checks if it’s between midnight and 3am, and allows the game to run if it isn’t, while throwing an error and exiting if it is.
Then you could add that script in the steam launch options for the game like this: path/to/script.sh %command%
And make sure the script is executable (with chmod +x /path/to/script.sh) or else it won’t run.

As for closing the game while it’s already running, a cronjob that runs every few minutes will do the trick.

Feel free to ask if you need help with the scripts or the setup.

1 Like

So i managed to set up the first part just fine. I’m a little stuck on the cron job.

I can see warframe.exe in the system monitor and I can find the path to it. How do I check for its existence in bash?

You can you use killall to kill a process by name, e.g. killall Warframe.x64.ex
I’d recommend at least giving the manpage a quick read with man killall

Just make sure to also check within the cronjob script if it’s currently between midnight and 3AM so that it only runs when it’s supposed to.

1 Like

Thanks for the info. I hope this helps. Unfortunately in the process of doing this I have realised there are many ways around this, oh well I live alone, not like someone else could have done this for me. Hopefully the path of increaced resistance will be enough

1 Like