Score:0

Cron job to restart server in xfce4-terminal: SESSION_MANAGER not defined

cn flag

I have a server running with a UI in an xfce4-terminal, and I have a cron job to restart it at 4am if certain files have been updated.

The restart script writes the date and time to a logfile, but when run from the cron job also records a message "Failed to connect to session manager: Failed to connect to the session manager: SESSION_MANAGER environment variable not defined" to the logfile. The server starts up normally anyway, so this seems to be a warning only.

When I run the same restart script manually from another xfce4-terminal, it works fine and writes the date and time to the logfile, but no warning message. There is no SESSION_MANAGER variable defined when I do this.

The command to restart the server does so with the following command in the restart script file:

DISPLAY=:0 $HOME/bin/server restart >>$HOME/restart.log 2>&1

This command runs another script which kills the existing server process and starts a new one using "xfce4-terminal -x".

How can I get rid of this warning message in the cron job, apart from "grep -v"?

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.