Bash Scripting anyone?

Status
Not open for further replies.

nuhll

Junior Member
Joined
Jul 8, 2015
Messages
193
Reaction score
17
Hi,
i have this script:
http://blog.rimuhosting.com/2013/10...shell-script-plugins-themes-crontab-and-more/

it updates all wordpress, just one problem: i have to enter everytime y (yes to start update).

1.) Could someone skip this question?
2.) And maybe some email like updated 20/20 wordpress, no errors...
3.) this script doesnt do the last step, when you update wordpress u need to click "update your wordpress db" before you can login into admin. This shoudl also be automatic.

So i can use this in cronjob...

Tell me what you want for it... no skype.
 
Last edited:
To skip question change this part



Code:
checkdeps() {

DEPSTOINSTALL='curl zip'
NEEDSINSTALL=""

for PKGSTOINSTALL in $DEPSTOINSTALL ; do
  if ! command -v $PKGSTOINSTALL &> /dev/null ; then
    NEEDSINSTALL="$NEEDSINSTALL $PKGSTOINSTALL"
  fi
done

  if [[ ! -z "$NEEDSINSTALL" ]]; then
    echo -e "$NEEDSINSTALL not installed, Install? (y/n) \c"
    read REPLY
    if [[ "$REPLY" = "y" ]]; then
          # Debian based
          if  command -v dpkg &> /dev/null; then
        apt-get install $NEEDSINSTALL 
          # RPM based
          elif command -v rpm &> /dev/null; then
        yum install $NEEDSINSTALL
          else
        echo "Your distro is not supported!"
        exit 1
          fi               
    
      fi
  fi

}


to this one



Code:
checkdeps() {


DEPSTOINSTALL='curl zip'
NEEDSINSTALL=""
REPLY = "y"


for PKGSTOINSTALL in $DEPSTOINSTALL ; do
  if ! command -v $PKGSTOINSTALL &> /dev/null ; then
    NEEDSINSTALL="$NEEDSINSTALL $PKGSTOINSTALL"
  fi
done


  if [[ ! -z "$NEEDSINSTALL" ]]; then
    if [[ "$REPLY" = "y" ]]; then
          # Debian based
          if  command -v dpkg &> /dev/null; then
        apt-get install $NEEDSINSTALL 
          # RPM based
          elif command -v rpm &> /dev/null; then
        yum install $NEEDSINSTALL
          else
        echo "Your distro is not supported!"
        exit 1
          fi               
    
      fi
  fi


}


Im don't test it but i'm sure it should works;)


P.S:also check this tool in google "WP-CLI" A command line interface for WordPress
 
Last edited:
Thanks, still "You have version 4.3 Standard Wordpress located at /home/ftp/XXX/ that needs updating to 4.3.1Would you like me to upgrade it? [y/N]"

PS:
wordpress-upgrade.sh: line 47: REPLY: command not found
 
try this one

Code:
checkdeps() {


DEPSTOINSTALL='curl zip'
NEEDSINSTALL=""


for PKGSTOINSTALL in $DEPSTOINSTALL ; do
  if ! command -v $PKGSTOINSTALL &> /dev/null ; then
	NEEDSINSTALL="$NEEDSINSTALL $PKGSTOINSTALL"
  fi
done


  if [[ ! -z "$NEEDSINSTALL" ]]; then


	      # Debian based
	      if  command -v dpkg &> /dev/null; then
		apt-get install $NEEDSINSTALL 
	      # RPM based
	      elif command -v rpm &> /dev/null; then
		yum install $NEEDSINSTALL
	      else
		echo "Your distro is not supported!"
		exit 1
	      fi               
  fi


}
 
the question is in line 123-125
change it
Code:
	echo "You have version $your_ver ${thisis} located at $wp_root that needs updating to ${WPCURRENT_VER}"
	#echo -n "Would you like me to upgrade it? [y/N] "
	yn="y"
	if [ $yn == "y" ];then
		echo "Upgrading $wp_root"
 
Does still not work, no one an idea?

If i # the echo, it just hangs.
 
Sry, i reverted all changes and just did what sockpuppet wrote, its now working, thanks.
 
1.) read everything and
2.) since there was NO OUTPUT and it just hangs, what else i can tell?
 
1. Check the time of my post, when you clicked Post, I was taking my time to write my post, in order to help you out (mofugga!)
2. "no output" - lowercase
1.) read everything and
2.) since there was NO OUTPUT and it just hangs, what else i can tell?
 
no need to fuck around.

Thanks for your help
 
Status
Not open for further replies.
This thread has been auto closed due to the forum's thread age policy. Read more.
Back
Top