Apr-30-2021, 02:04 PM
Hi Folks,
I got a task to "convert" few codes line from BASH script to Python script , I would like to know how do you suggest to write in Python ?
the BASH code example of download and install app:
I got a task to "convert" few codes line from BASH script to Python script , I would like to know how do you suggest to write in Python ?
the BASH code example of download and install app:
#get parameters echo "Make sure you a root" read VERSION #variables echo "set variables" DIR=$(cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P) APP=/app HOME=/home INSTALL=/install CONFIG=/install/$(date '+%d-%b-%Y') echo "variables set" # backup config files echo "backup config" mkdir $CONFIG ## config /bin/cp -f $APP/bin/setenv.sh $CONFIG/ /bin/cp -f $APP/conf/server.xml $CONFIG/ echo "backup completed" # shut down jira app echo "shut down app" /etc/init.d/jira stop echo "jira app down" # clean up home folder echo "clean up home folder" rm -rf /home/caches/ rm -rf /home/log/ echo "home folder cleaned up" # download install echo "install jira" wget -P $INSTALL https://www.atlassian.com/software/jira/downloads/binary/atlassian-jira-software-$JIRAVERSION-x64.bin chmod a+x $INSTALL/atlassian-jira-software-$JIRAVERSION-x64.bin $INSTALL/atlassian-jira-software-$JIRAVERSION-x64.bin -q -varfile $DIR/response.varfile echo "jira installed" # restore config files echo "restore jira config files" /bin/cp -f $CONFIG/setenv.sh $APP/bin/ /bin/cp -f $CONFIG/server.xml $APP/conf/ # set permissions echo "set permissions" chown -R jira:jira /jira chmod -R 775 /jira echo "permissions set" # start jira echo "shut down jira" /etc/init.d/jira start echo "jira started" #doneThank you