I have an user "postgres". And I want to run some cron job which should to work under it's account - "postgres". When it's running as a "postgres" then psql
will automatically connect as a "postgres" user, without any passwords and similar...
I can do it easy with standard cron - just to add a cron job for the user "postgres". How to do it with systemd?
PS. I read that I have to create 2 "units": one for the timer and another one for the "job". But at the time - that the timer can work for active/logged-in users only. Sure, "postgres" user will not log-in. It won't be active. So, is it possible to do it with systemd, and if yes, please, show me how to achieve it.
sudo crontab -u postgres -e
User
key in theService
stanza tells which user the service runs as. Of course, this requires you to have root privileges on the system. Would this be acceptable to you?