As pointed out in a comment above, the most obvious pbm is that you are not using the -O
option correctly.
Look up man wget
in terminal. Here is an extract:
-O file
--output-document=file
.
The documents will not be
written to the appropriate files, but all will be concatenated
together and written to "file". If -
is used as file, documents
will be printed to standard output (stdout), disabling link conversion.
Use ./-
to print to a file literally named -
.
Use of -O
is
analogous to shell redirection:
wget -O file http://foo
is
intended to work like wget -O - http://foo > file
; where "file" will be
truncated immediately, and all downloaded content will be written
there.
If, as a non root user, you run a GUI cmd or direct yr output to stdout
in an already running X session, make sure yr cron
environment knows about the active display. To make cron
GUI aware, i.e. to tell it, what display the program should use (:0
is the default in a desktop environment)
0 1 * * * export DISPLAY=:0; XAUTHORITY=~/.Xauthority /usr/bin/wget -O - http://192.10.10.1/mypage/myscript.php
or, if you want to set the DISPLAY environment variable ONLY for a specific cmd:
0 1 * * * DISPLAY=:0 XAUTHORITY=~/.Xauthority /usr/bin/wget -O - http://192.10.10.1/mypage/myscript.php
or, if redirecting output to a file for later perusal, the need to specify the correct display disappears because nothing actually goes to stdout
:
0 1 * * * /usr/bin/wget -O <filename> http://192.10.10.1/mypage/myscript.php
The latter solution makes more sense, if you run yr cron job at 1am and you are not sitting in front of yr desktop display.
==
Let us known in case of continuing problems.
cron
editing ascrontab -e
as your normal user? – Terrance Apr 12 '16 at 02:23crontab -e
– MisterBushido Apr 12 '16 at 02:43which wget
, does it return/usr/bin/wget
? If it does, check your crontab environment by adding a line to it that says* * * * * env > /home/<username>/env_dump.txt
so that you can see what the environment is set to. Hopefully the/usr/bin
is in your path environment. Remove the line from crontab after 1 minute. It will create the file. – Terrance Apr 12 '16 at 02:52