Skip to content
Snippets Groups Projects
Commit 3753cd89 authored by Andreas Ellewsen's avatar Andreas Ellewsen
Browse files

Add scripts used on VM for cristin-ms

parent 2756f20f
No related branches found
No related tags found
No related merge requests found
[Unit]
Description=Cristin cleanup
After=network.target
[Service]
Type=simple
User=bottint
WorkingDirectory=/home/bottint/cristin/uib/prod/archive
ExecStart=/usr/local/bin/cristin-cleanup.sh
[Install]
WantedBy=multi-user.target
#!/bin/bash
printf "Deleting files older than 30 days"
find -maxdepth 1 -name "*.xml" -mtime +30 -exec rm {} \;
[Unit]
Description=Weekly cristin export upload
[Timer]
OnCalendar=Sun 4:15
AccuracySec=24h
Persistent=true
[Install]
WantedBy=timers.target
[Unit]
Description=Cristin export upload
After=network.target
[Service]
Type=simple
User=bottint
WorkingDirectory=/home/bottint/cristin/uib/prod
ExecStart=/usr/local/bin/upload.sh
[Install]
WantedBy=multi-user.target
[Timer]
OnCalendar=Sat 4:15
AccuracySec=24h
Persistent=true
[Install]
WantedBy=timers.target
#!/bin/bash
# Upload script
COUNT=0
rm sftp_batch.tmp
# Find files and write batchfile to be passed to sftp
for output in $(ls *.xml -1)
do
COUNT=1
printf "put -P \"$output\"\n" >> sftp_batch.tmp
done
# Exit if nothing to upload
if [[ $COUNT -eq 0 ]]; then
#printf "$0: No files to upload" >$2
exit 1
fi
# Output which commands we will be running
#printf "Connecting with sftp and executing following commands:\n"
#printf "$(<sftp_batch.tmp)"
sftp -b sftp_batch.tmp cristin-export@norzola.uio.no:cristin/ || exit 1
#scp $output cristin-export@norzola.uio.no:cristin/ || exit
#Archive transferred files
for output in $(ls *.xml -1)
do
mv $output archive/
done
rm sftp_batch.tmp
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment