Tag Info

New answers tagged

0

It seems that your clamscan didn't generate any log file on output. Just change clamscan blah blah >/dev/null 2>/dev/null to clamscan blah blah &>/tmp/scan.log and check the scan.log - there probably some hints.


0

I'm on Fedora 20 and suddenly started to have this error on newly installed systems. All previous hosts (>70) just were able to so something like: echo "Hello world" | mail -s "Salute" johndoe@somehost.com so useful from scripts and so on. Now command line invocations started to fail with sSMTP[3144]: Unable to connect to "mail" port 25. sSMTP[3144]: ...


0

To check for a runinng process you can list all the running processes (with ps) and then filter the one you're looking for with grep: ps aux | grep YOUR_PHP_COMMAND If you want to start your command only when it's not running you can use the following script: CMD="/bin/sleep 3" # replace it with your command if ! ps x|grep -v grep|grep "$CMD"; then ...


0

I see a little problem content of the dispatchingEmail_I is: 54 19 * * * root /home/harbir/project/L_ocalRepository/smallworks/maildispatcher.sh and the permissions of the file maildispatcher.sh are the following: -rwxrwx--- 1 harbir users 621 Sep 10 06:33 maildispatcher.sh shouldn't you be running maildispatcher.sh as harbir rather ...


0

If you just want to make sure that your script restarts when it dies, you can do something like while true ; do php my_script.php ; done > /dev/null This will wait for my_script.php to finish running, and then run it again. All output will be sent to /dev/null If you want to use nohup, then you should do the following $ echo 'while true ; do php ...


3

You have one field too many in the crontab line. It should be minute hour dayofmonth month dayofweek command You have an asterisk character in place of the command. Also, if you want a crontab entry to run as root, it's arguably cleaner to put it in a /etc/cron.d/ file than in root's own user-level crontab. Note that system crontabs (i.e. /etc/cron*) ...


1

~/.zshenv is loaded by zsh when it starts (except when started with -f or if the configuration directory is changed by setting ZDOTDIR). It is not loaded (cannot be understood) by any other shell. So arranging load ~/.zshenv is equivalent to arranging for your jobs to be executed by zsh. Set the SHELL variable in the crontab; this applies to every job. ...


0

With nohup you must redirect also errors. The next command run script with output and errors redirecting to /dev/null: nohup php my_script.php >/dev/null 2>&1 & But your script can be terminated by some other reasons (error in script, oom-killer, etc). So, you should daemonise it by system's init (if it support auto-restart - upstart, ...


2

Perhaps you want to see what's going on and not redirect output to /dev/null. I suggest you open a screen or tmux session. Both are terminal multiplexers, which will stay alive even if you log out. E.g. (..) for info $ screen $(inside screen-t1): ./get_tweets.php .... running first Now press Ctrl-a c to open a new terminal. $(inside screen-t2): ...


4

midnight is 0 0 * * * /usr/bin/php /www/sites/[domain.com]/files/html/shell/indexer.php reindexall your current crontab runs every full hour. For more info see e.g. this


0

If your script file is invoked by cron and it contains a shell in the first line like #!/bin/bash you need to find the parent-parent name for your purpose. 1) cron is invoked at the given time in your crontab, executing a shell 2) shell executes your script 3) your script is running The parent PID is available in bash as variable $PPID. The ps command to ...


3

The problem is that cron runs in a text environment. There are a few different approaches for that, depending on what your machine is running. set a display variable: * * * * * DISPLAY=:0.0 /home/my-user-name/Documents/bin/program set up a password-less ssh key-pair and do * * * * * /usr/bin/ssh -y user@localhost ...


2

THe @reboot entry is started when cron is started, but that doesn't mean everything necessary to run your bundle application is up and running. Depending on the setup, e.g. your network might not be up at that time. I would do the following in your case: have the reboot job write a unique file in some known place have a normal cronjob that executes on a ...


0

I am not so sure about bundling the emails but i know you could change youre cronjobs with crontab -e there you could for example cat email1 | for file in /email/dir/; do cat $file >> email1 Here you append all youre emails to one big email so you will only have one file. Hope this works for you


2

Most versions of cron run commands using /bin/sh by default, and if the commands run any shell scripts (that don't have a #! line to force use of a specific shell), /bin/sh will be used to run them, too. On some systems, /bin/sh is dash, a shell that doesn't understand the ANSI-C quoting convention used by bash and other shells. So your $'\n' string is ...


-1

Wi-Fi? You could ping your own router instead of "major sites", there is always a small chance the connection is keep dropping somewhere on your end instead of your ISP's domain servers or routers. As the matter of fact the script approach is excellent, keep pinging the LAN side with increasing interval and see how much time it takes for the connection to ...


3

crontab entry for every week (Monday at 3:10 pm): 10 15 * * 1 test -x /path/to/your/weekly/command && /path/to/your/weekly/command and every 3 months, on the 2nd of January, April, July, and October at 1:12 pm: 12 13 2 1,4,7,10 * test -x /path/to/your/quarterly/cmd && /path/to/your/quarterly/cmd This is for a normal user's crontab ...


5

It it perfectly Ok to use MAILTO= per-entry, i.e.: MAILTO="address1" 0 0 * * * /foo/foo.sh MAILTO="address2" 0 2 * * * /foo/foo2.sh MAILTO="address3" 0 4 * * * /foo/foo3.sh MAILTO="address4" 0 6 * * * /foo/foo4.sh 0 8 * * * /foo/foo5.sh 0 10 * * * /foo/foo6.sh And so on. Cheers,


1

I am not sure if this is what you are looking for. From that answer, I see it as, ORIGMAILTO="$MAILTO" MAILTO=you * * * ... your cron job MAILTO="$ORIGMAILTO"


1

You can simply run a cron by the following tutorial http://findoutanswer.com/48/please-provide-some-linux-cron-job-examples?show=48#q48


3

You need to escape the percent characters using a backslash: .../SK_ITEM_EXTRACT_MFGPRO_$(date +\%m\%d\%y).txt From the crontab(5) man page from the ISC implementation of cron: The ``sixth'' field (the rest of the line) specifies the command to be run. The entire command portion of the line, up to a newline or % character, will be executed by /bin/sh ...


0

1) In general, files in /var/www should be owned by root:www-data and chmod 644, while /var/www itself and all subdirectories should be chmod 755. They should not be writable by the www-data user unless absolutely necessary (and that goes triple for executable files) because files which are writable by www-data can be modified by an attacker who manages to ...


0

(1) chmod and chown are different commands. The first sets permissions and the second ownership. You may wish to also run `find /var/www/html -exec chown www-data:www-data {} +` in addition to the commands you are already running, but that is a choice for you to make. (2) You can edit /etc/cron.allow and add www-data to allow the www-data user to run ...


0

You can put files in your /etc/cron.d as root (or if you are have sudo). You could do something like this ... # cat > /etc/cron.d/mycronjob <<EOT * * * * * /bin/logger "Hello from cron" EOT ... then you can watch your cron job write the system log like so ... # tail -f /var/log/messages


3

Each user has their own scheduled tasks. If you go and pick your kid from school at 4pm every day, your neighbor doesn't also go and pick your kid at 4pm. Cron jobs can be registered by each user (in which case they run with that user's privileges) or at the system level (in which case they run as a user chosen by the system administrator). Each scheduled ...


0

Louis' answer is great. I propose a slight possible improvement. Instead of creating a file /tmp/command which contains the path to the script you want to execute as Louis suggested in the following code: cat [path to dumpfile crated earlier] /tmp/command | xargs -0 -x env -i Instead you can name the script directly in the command via the following ...


1

I think the issue is with your if statement. if ! ping -q -w 1 -c 1 $(ip r | grep default | cut -d ' ' -f 3) More specifically: ping -q -w 1 -c 1 $(ip r | grep default | cut -d ' ' -f 3) The host ip isn't passed properly. Note that each portion works by itself (i.e. ping host and ip r....). This has been working for me: $ ip r | grep "default" | cut ...



Top 50 recent answers are included