Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • You saved my day! Thanks. BTW, Any document for this? Commented Sep 8, 2014 at 20:50
  • 1
    You're welcome. I can't think of any document that states this explicitly. It's more of a matter of knowing how Unix/Linux works, and realising that crond runs before X. So, even if a cron job gets run as a user, it won't inherit the knowledge of the users X-Session (or environment variables that are set after you log in). Commented Sep 8, 2014 at 20:59
  • 1
    @gongzhitaao When you run a program in UNIX world, you can before running initialize a env variabel such as : root@debian:/opt /ldoce5# myvar=googooli ./ldoce5-bin & Each program when that run, has a directory with its PID in /proc/, in my example: /proc/21959/ and each process has a file named environ, i use cat environ , i saw the following result: myvar=googooliXDG_VTNR=7ORBIT_SOCKETDIR=/tmp/orbit-mohsenXDG_SESSION_ID=10SSH_AGENT_PID=6196TERMINATOR_UUID (yes a set of variable and you can see myvar) Commented Sep 8, 2014 at 21:00