Advertisement
Dyrcona

20230205.sh

Feb 2nd, 2023 (edited)
1,171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.54 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Upgrade jasontest to Evergreen 3.10.0:
  4. psql -U evergreen -h localhost -d jasontest -f ${HOME}/cwmars-3.7.3-3.10.0-upgrade-db.sql >& $(date %F)-upgrade.log &
  5. disown -h
  6.  
  7. # All of this to set up for next month.
  8. prog=${0##*/}
  9. where=${0%$prog}
  10. y=$(date +%Y)
  11. m=$(date +%m)
  12. let m=m+1
  13. # This should not be necessary after April 2023.
  14. if [ $m -lt 5 ]; then
  15.     printf -v calarg "%d-%02d" $y $m
  16.     d=$(cal -d $calarg | awk 'NF==7&&NR>2{print $1;exit}')
  17.     printf -v new "%s%d%02d%02d.sh" $where $y $m $d
  18.     mv $0 $new
  19. fi
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement