mirror of https://github.com/tteck/Proxmox.git
				
				
				
			feat(scripts): cronjob
This commit is contained in:
		
							parent
							
								
									a0309b2896
								
							
						
					
					
						commit
						402ebdf0fd
					
				| 
						 | 
					@ -74,43 +74,15 @@ cat <<EOF >/opt/freegamesclaimer/data/config.env
 | 
				
			||||||
EOF
 | 
					EOF
 | 
				
			||||||
msg_ok "Created dummy config file"
 | 
					msg_ok "Created dummy config file"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
msg_info "Initializing gaming services to claim games for"
 | 
					msg_info "Creating cron jobs"
 | 
				
			||||||
CHOICES=$(whiptail --title "Select game services" --separate-output --checklist "Select services" 20 78 4 "EPIC" "Epic Games" OFF "GOG" "Good Old Games" OFF 3>&1 1>&2 2>&3)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function setup_epic() {
 | 
					 | 
				
			||||||
  $STD node epic-games || success=false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  msg_info "Creating daily cronjob for epic games"
 | 
					  msg_info "Creating daily cronjob for epic games"
 | 
				
			||||||
  (crontab -l ; echo "0 0 * * * cd /opt/freegamesclaimer && node epic-games") | crontab -
 | 
					  (crontab -l ; echo "0 0 * * * cd /opt/freegamesclaimer && node epic-games") | crontab -
 | 
				
			||||||
  msg_ok "Cronjob created"
 | 
					  msg_ok "created"
 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function setup_gog() {
 | 
					 | 
				
			||||||
  $STD node gog || success=false
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  msg_info "Creating daily cronjob for gog"
 | 
					  msg_info "Creating daily cronjob for gog"
 | 
				
			||||||
  (crontab -l ; echo "02 0 * * * cd /opt/freegamesclaimer && node gog") | crontab -
 | 
					  (crontab -l ; echo "02 0 * * * cd /opt/freegamesclaimer && node gog") | crontab -
 | 
				
			||||||
  msg_ok "Cronjob created"
 | 
					  msg_ok "created"
 | 
				
			||||||
}
 | 
					msg_ok "Cron jobs created"
 | 
				
			||||||
 | 
					 | 
				
			||||||
echo $CHOICES
 | 
					 | 
				
			||||||
if [ ! -z "$CHOICES" ]; then
 | 
					 | 
				
			||||||
    for CHOICE in $CHOICES; do
 | 
					 | 
				
			||||||
      case $CHOICE in
 | 
					 | 
				
			||||||
      "EPIC")
 | 
					 | 
				
			||||||
        setup_epic
 | 
					 | 
				
			||||||
        ;;
 | 
					 | 
				
			||||||
      "GOG")
 | 
					 | 
				
			||||||
        setup_gog
 | 
					 | 
				
			||||||
        ;;
 | 
					 | 
				
			||||||
      *)
 | 
					 | 
				
			||||||
        echo "Unsupported item $CHOICE!" >&2
 | 
					 | 
				
			||||||
        exit 1
 | 
					 | 
				
			||||||
        ;;
 | 
					 | 
				
			||||||
      esac
 | 
					 | 
				
			||||||
    done
 | 
					 | 
				
			||||||
  fi
 | 
					 | 
				
			||||||
msg_ok "Services initialized: ${CHOICES}"
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
motd_ssh
 | 
					motd_ssh
 | 
				
			||||||
customize
 | 
					customize
 | 
				
			||||||
| 
						 | 
					@ -119,3 +91,8 @@ msg_info "Cleaning up"
 | 
				
			||||||
$STD apt-get -y autoremove
 | 
					$STD apt-get -y autoremove
 | 
				
			||||||
$STD apt-get -y autoclean
 | 
					$STD apt-get -y autoclean
 | 
				
			||||||
msg_ok "Cleaned"
 | 
					msg_ok "Cleaned"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					msg_ok "Completed Successfully!\n"
 | 
				
			||||||
 | 
					echo -e "${APP} has been setup to claim GOG and Epic games. \n
 | 
				
			||||||
 | 
					         Please add your credentials to /opt/freegamesclaimer/data/config.env \n"
 | 
				
			||||||
		Loading…
	
		Reference in New Issue