Difference between revisions of "Plesk Application Vault"

From Atomicorp Wiki
Jump to: navigation, search
m (Protected "Plesk Application Vault" (‎[edit=sysop] (indefinite) ‎[move=sysop] (indefinite)) [cascading])
 
(3 intermediate revisions by one user not shown)
Line 20: Line 20:
  
  
#!/bin/sh
+
  #!/bin/sh
 
+
  MYSQL="mysql -u admin -p`cat /etc/psa/.psa.shadow` psa -B -s -e"
mysql -u admin -p`cat /etc/psa/.psa.shadow` psa
+
  if [ "$1" == "" ]; then
 +
    echo
 +
    echo "  $0 Usage"
 +
    echo "  $0 list "
 +
    echo "  $0 delete <id>"
 +
    echo
 +
    exit 1
 +
  fi
 +
  if [ "$1" == "list" ]; then
 +
    $MYSQL "select name, version, id from SiteAppPackages order by name"
 +
  elif [ "$1" == "delete" ]; then
 +
    NAME=`$MYSQL "select name from SiteAppPackages where id= $2"`
 +
    VERSION=`$MYSQL "select version from SiteAppPackages where id=$2"`
 +
    REVISION=`$MYSQL "select release from SiteAppPackages where id=$2"`
 +
    echo
 +
    echo "Checking $NAME-$VERSION-$REVISION"
 +
    echo -n "  "
 +
    rpm -qf /usr/local/psa/var/cgitory/$NAME-$VERSION-$REVISION && RPM=1 || RPM=0
 +
    if [ $RPM -gt 0 ] ; then
 +
      echo "  Not deleting, package is managed by RPM "
 +
      echo
 +
    elif [ $RPM -lt 1 ]; then
 +
      echo "  Deleting unmanaged package"
 +
      $MYSQL "delete from SiteAppPackages where id = $2"
 +
      rm -rf /usr/local/psa/var/cgitory/$NAME-$VERSION-$REVISION
 +
      echo
 +
      echo
 +
    else
 +
      echo "Error, something went wrong"
 +
      exit 1
 +
    fi
 +
  else
 +
    echo "Error, invalid syntax"
 +
    exit 1
 +
  fi

Latest revision as of 12:41, 28 June 2024

Problem:

sappmng: utility /bin/rpm failed (result=1):

file /usr/local/psa/var/cgitory/AardvarkTopsites-5.1.2-3 is not owned by any package

sappmng: Cannot get package name for AardvarkTopsites-5.1.2-3

proc_close() failed:


Description:

This is a 3rd party mod from CPSkins.com that isnt being managed with RPMS. Plesk expects the packages to be managed by an RPM, in this context sappmng can't detect the rpm. One fix would be to make a [mule] after the fact to capture this. Cleaning out the unmanaged packages one by one is a chore.


Fix:

I made a lightweight management script, the following will list the packages, or delete.


 #!/bin/sh
 MYSQL="mysql -u admin -p`cat /etc/psa/.psa.shadow` psa -B -s -e"
 if [ "$1" == "" ]; then
   echo 
   echo "  $0 Usage"
   echo "  $0 list "
   echo "  $0 delete <id>"
   echo
   exit 1
 fi
 if [ "$1" == "list" ]; then
   $MYSQL "select name, version, id from SiteAppPackages order by name"
 elif [ "$1" == "delete" ]; then
   NAME=`$MYSQL "select name from SiteAppPackages where id= $2"`
   VERSION=`$MYSQL "select version from SiteAppPackages where id=$2"`
   REVISION=`$MYSQL "select release from SiteAppPackages where id=$2"`
   echo
   echo "Checking $NAME-$VERSION-$REVISION"
   echo -n "  "
   rpm -qf /usr/local/psa/var/cgitory/$NAME-$VERSION-$REVISION && RPM=1 || RPM=0
   if [ $RPM -gt 0 ] ; then
     echo "  Not deleting, package is managed by RPM "
     echo
   elif [ $RPM -lt 1 ]; then
     echo "  Deleting unmanaged package"
     $MYSQL "delete from SiteAppPackages where id = $2"
     rm -rf /usr/local/psa/var/cgitory/$NAME-$VERSION-$REVISION
     echo 
     echo 
   else
     echo "Error, something went wrong"
     exit 1
   fi
 else
   echo "Error, invalid syntax"
   exit 1
 fi
Personal tools