I'm using unison
to synchronise data to a server, and I've recently created a cronjob for this. The cronjob is running at startup and saves the output to a log file. (additional info below).
The problem I'm having is that unison has quite a lot of output, and I'd like to only save the summary to the log file. Is there a way to do that? I haven't found a way to make unison less verbose, so I thought maybe the output can be filtered somehow - I just wouldn't know how.
Thanks!
Additional info:
Right now, the log file ends up looking like this:
Contacting server...
Connected [//theserver//share/HDA_DATA/elrudi -> //thelaptop//home/elrudi]
Looking for changes
\ syncAll/Code/Aptana/T...avascript library code assist.txt
\ syncAll/Code/develope...nk/20070607 contacten (INDEX).xls
\ syncAll/Code/sourcefi...okexport/photos/10152112061815397
| syncAll/Code/Python/d...rawable-hdpi/ic_action_search.png
(... many many lines ...)
| syncAll/Work/2008_10 ...profile/StandardLastprofil_H0.xls
| syncAll/Work/2008_10 ...n/Load Profiles/Lastprofil_H0.xls
Waiting for changes from server
Reconciling changes
changed ----> syncAll/scriptfile1.sh
Propagating updates
UNISON 2.40.102 started propagating changes at 12:07:31.55 on 07 Oct 2015
[BGN] Updating file syncAll/scriptfile1.sh from /home/elrudi to //theserver//share/HDA_DATA/elrudi
100% 00:00 ETA
[END] Updating file syncAll/scriptfile1.sh
100% 00:00 ETA
UNISON 2.40.102 finished propagating changes at 12:07:31.61 on 07 Oct 2015
100% 00:00 ETA
Saving synchronizer state
Synchronization complete at 12:07:36 (1 item transferred, 0 skipped, 0 failed)
I'd want to ditch the lines starting with |
, /
, -
, or \
(the spinning bar indicating a process is not finished yet).
More additional info:
crontab -e
shows
@reboot /home/elrudi/sync.sh -batch 60 >> /home/elrudi/.cronjobs.log 2>&1
The sync.sh
script checks whether the server is locally reachable or remotely, and runs the appropriate unison
command. The -batch
parameter is added to make unison
run without user input, and the 60
is a waiting time (to make sure unison
does not run before a connection is available).
sed
orgrep
first to filter the output.-terse
option to unison? (never tried it --- but the manual says "-terse: suppress status messages")-terse
is not bad either. It's a bit too quiet for my taste, but it'd have done the job too, thanks for the suggestion!