bash - How do I pass the tail of a log file to a command? -


i have quite few long-running processes , use command text me @ various points throughout script , let me know when has completed:

curl http://textbelt.com/text -d number=<phone number> -d "message=doneskiiz" 

instead of basic message include tail of log file in message can see last few lines know if successful , peek @ result. if possible i'd current time included (or in second message).

steps:

a) execute "date" retrieve current date

b) execute "tail -n nnn" retrieve "nnn" last lines of log file

c) execute "curl" "--data-binary @file" or "--data-binary @-" or "-f field=@filename" post previous information.

you can see similar example @ curl: pass named parameter stdin:

tail -n 20 my.log | curl -d date="$(date)" -d number="555123" -f log=@- "http://somewhere"  

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -