I have a .NET Core 3.0 Console App, running on a Ubuntu 18.04 server. There is a simple launcher script in my home folder, called my-app.sh
:
cd /home/service/my-app
./My-App
I wanted to start the file after reboot, so I created a cronjob for the launcher script, using crontab -e
:
@reboot /home/service/my-app.sh
After reboot, MyApp lauches perfectly fine. But, when calling df
repeatedly, I noticed that the free disk space of /
was continuously decreasing! I tried to find out which file it is, but ncdu
did not show any difference over time. I am not writing a file in MyApp, i.e. the total size of /home/service
does not increase. After about 10 minutes, the whole free space is gone, and MyApp is quit by the system.
When I cancel MyApp after reboot, I see that the "memory leak" is immediately stopped. But: When I restart MyApp manually, there is no memory leak any more.
Now I tried to remove the cronjob and added the launcher script to the /etc/local.rc
file instead:
# Start MyApp
su service -c 'sh /home/service/my-app.sh' &
Again, it started perfectly fine after reboot, and there is also no memory leak any more.
I have no idea at all what could be the problem. There is no problem when starting manually or from /etc/local.rc
, but just when starting from the cronjob. Any idea what could be the problem?