Re: how can i send an attached file from command line?



On Tue, 13 Feb 2007 23:33:27 -0800, rh00667 wrote:

hi,

i need to "cron" a mail attaching a binary file. i am using

uuencode file | mail -s subject destination

uuencode now is not in standard packages, so i compiled it.

is there another easier form to do this?

tia

On my system mail is a symbolic link to nail. nail's "-a" flag specifies
a file to attach; man nail

The other part of nail's behavior, which you are getting around using a
pipe, is that it expects the body of the message on the command line,
terminating with a CTRL-D. Here are a couple of alternatives.


You can keep using a pipe:

echo 'Job at $(date)' | mail -s subject -a file someone@localhost

or, use a "HERE" document:

mail -s "Job at $(date "+%Y%m%d.%H%M%S")" -a somefile \
someone@localhost <<EOM
EOM

Verify any of the above commands are appropriate for your system.

Going offtopic...
There is one other minor glitch when using multiple line commands when
using "at" instead of "cron." IIRC, cron requires encapsulation of jobs
into scripts which are executed on a recurring time interval. "at" has a
more flexible execution schedule: "at" jobs execute once at the time
specified. If the job consists of multiple commands then it is simpler to
put all of the commands into a simple script, too. That avoids
unnecessarily complex command lines.

--
Douglas Mayne
.



Relevant Pages

  • Re: Execution job class restriction
    ... with) in the GUIDE "JES Job Scheduling and Control" Task Force ... What about operator commands ... point where the JOB's CLASS was valid (on some eligible member)? ... MVS image finally selected the JOB for execution at 3:45 AM, ...
    (bit.listserv.ibm-main)
  • Re: Privileged mode commands in FreeBSD processes
    ... execute processor commands of previleged modes, ... time of execution this process to the mode with higher privileges (to ... FreeBSD community, does this possibility exist in FreeBSD? ... You can try to jump into userspace address from the ring 0 mode, ...
    (freebsd-arch)
  • Re: Inexact Matches -- disable?
    ... Execution of an incorrect funtion when a non-existant function ... This "broken behavior" is the MATLAB has ALWAYS worked for functions ... Internal MALTA commands like plot, min, max, etc. are a little ... There are many languages where commands are case insensitive. ...
    (comp.soft-sys.matlab)
  • Re: Privileged mode commands in FreeBSD processes
    ... execute processor commands of previleged modes, ... time of execution this process to the mode with higher privileges (to ... FreeBSD community, does this possibility exist in FreeBSD? ...
    (freebsd-arch)
  • Re: EXEC and Windows XP
    ... These 2 "commands" are calls to procs in other tcl files. ... somewhere between the 2nd and 3rd line execution. ... returned from this EXEC statement. ...
    (comp.lang.tcl)