Cron to stop and start deepstream app every day at midnight

Hello,

I would like to automatically stop and restart deepstream at midnight everyday

I assume cron would be good for this?
I wanted to make a restart-DSapp.sh script and get cron to run it at midnight

I found the below on a linux website - I’ve edited it to work for me

#!/bin/sh

# Kill app
sudo pkill DSapp

# Change directory  
cd /home/myapp/

# Restart DS 
sudo ./start-DSapp.sh

I can run this from terminal and it will kill and restart my deepstream app

using crontab it will stop deepstream but won’t start it again

How do I make it start?
Is there a better way to do this?

thanks

You probably need to export the DISPLAY variable in the script before you start the app, because the default cron environment is not windowed.

Also: Cron typically runs on UCT time, not your local time, so if you mean “middle of the night, my time,” then you’ll want to calculate what that means in UCT and configure the crontab time to be that corresponding time.

Thanks ,

I’ve now tried adding export DISPLAY=:0 and 0.0 into both my cron and my .sh but no luck

any pointers?

thanks

Hi,
Maybe you can set up two crontab. One is to start he application and the other is to stop it. One is at 11:55 and the other is at 12:00

thanks DaneLLL

Yes I have separated into 2 jobs, and. can make it stop however I cannot get deepstream to launch as cron won’t open a window

I tried exporting the display but that didn’t work

The app wants to launch from terminal but I cannot make this work from cron

if you can help me it would be very much appreciated

thanks

Hi,
There are several types in Sink Group. Please try type=1 and type=5. To check if the issue is specific to nveglglessink.

Hi,

If I use sink=1 or 5 the process does start however no window opens

How do I start it and have a window open as well?

thanks

Hi,
Looks like nveglglesink does not work in the case. Could you try to run the command with DISPLAY=:0(or 1)? Like:

$ DISPLAY=:0 gst-launch-1.0 videotestsrc ! nvvidconv ! nvegltransform ! nveglglessink

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.