Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The line before the interpreter directive - before the <code>#!</code> line - is wrong but may not be your problem. The <code>#!</code> is only special as the first two characters of a executable file, and identifies what program should open it (<code>/bin/bash</code> in this case). The shells will tend to try to interpret scripts by defaulting to themselves, but this isn't reliable - especially for non-sh scripts.</p> <p>Secondly, <a href="http://www.talisman.org/~erlkonig/documents/commandname-extensions-considered-harmful" rel="nofollow">http://www.talisman.org/~erlkonig/documents/commandname-extensions-considered-harmful</a></p> <p>So in <code>/custom/update</code></p> <pre><code>#!/bin/bash # update /usr/bin/freshclam maldet -b -a /home </code></pre> <p>then run: <code>chmod +x /custom/update</code></p> <p>In <code>./doandmail</code>:</p> <pre><code>#!/bin/bash # doandmail SUBJECT="Shell Script" # these don't need to be uppercase EMAIL="myemail@gmail.com" # ...though it doesn't hurt anything EMAILMESSAGE="mail.txt" # usually only exported variable are upper. /custom/update | /bin/mail -s "$SUBJECT" "$EMAIL" # no need for a tmp file. </code></pre> <p>Then: <code>chmod +x doandmail</code></p> <p>When your <code>crontab</code> runs, it won't have the same directory you're thinking, or even the same environment you might expect, unless you set them explicitly. It's most likely breaking on the <code>./update</code>... line in <code>doandmail</code>. Hence the <code>/custom/update</code> above.</p> <p>In your crontab:</p> <pre><code>@hourly /custom/doandmail </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload