Git edit remote origin URL

To edit remote origin URL in Git configuration file can be edited:

# more /home/taras/.git/config

[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote “origin”]
url = ssh://git@bitbucket.org/podlom/example.git
fetch = +refs/heads/*:refs/remotes/origin/*

#

Where url = ssh://git@bitbucket.org/podlom/example.git new example path.

To check new settings use command:

# git remote -v

origin ssh://git@bitbucket.org/podlom/example.git (fetch)
origin ssh://git@bitbucket.org/podlom/example.git (push)

#

Create second MySQL database and give privileges to one user

To create second MySQL database and give privileges to the same user the following commands can be used:

# mysql -h localhost -u root -p
mysql> SHOW CREATE DATABASE `database_name`;
mysql> CREATE DATABASE `database_name2` /*!40100 DEFAULT CHARACTER SET utf8 */;
mysql> SHOW GRANTS FOR database_user;
mysql> GRANT ALL PRIVILEGES ON `database\_name2`.* TO 'database_user'@'%';
mysql> FLUSH PRIVILEGES;
mysql> SHOW GRANTS FOR database_user;
mysql> quit;

SHOW CREATE DATABASE `database_name`; will show first MySQL create database DDL SQL query.

CREATE DATABASE `database_name2` /*!40100 DEFAULT CHARACTER SET utf8 */; will create second MySQL database.

SHOW GRANTS FOR database_user; is used to view current user grants.

GRANT ALL PRIVILEGES ON `database\_name2`.* TO ‘database_user’@’%’; grant all privileges to newly created database;

FLUSH PRIVILEGES; will apply new user privileges.

SHOW GRANTS FOR database_user; is used to view updated user privileges;

quit; to exit MySQL client program.

Connect to remote host via ssh proxy

To connect to remote server via ssh proxy use can use the following sequence of commands:

# lsof -i :2222
# ssh -f proxy_user@proxy_host -L 2222:destination_host:22 -N
# ssh -p 2222 destination_user@localhost

If TCP port 2222 is free you will not see any output. So you can use it for SSH proxied connection.

proxy_user – SSH user on SSH proxy server proxy_host.

destination_host – IP or host name of remote server where should we connect using proxy_host server as SSH proxy.

destination_user – SSH user on destination_host server.

apachectl – web server Apache control interface

To view possible options of apachectl – web server Apache server control interface run command:

root@shkodenko:~# apachectl --help
Usage: /usr/sbin/apachectl start|stop|restart|graceful|graceful-stop|configtest|status|fullstatus|help
       /usr/sbin/apachectl <apache2 args>
       /usr/sbin/apachectl -h            (for help on <apache2 args>)
root@shkodenko:~#

To view full version information run:

root@shkodenko:~# apachectl -V
Server version: Apache/2.2.22 (Debian)
Server built:   Feb  1 2014 21:26:04
Server's Module Magic Number: 20051115:30
Server loaded:  APR 1.4.6, APR-Util 1.4.1
Compiled using: APR 1.4.6, APR-Util 1.4.1
Architecture:   64-bit
Server MPM:     Prefork
  threaded:     no
    forked:     yes (variable process count)
Server compiled with....
 -D APACHE_MPM_DIR="server/mpm/prefork"
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D APR_USE_SYSVSEM_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=128
 -D HTTPD_ROOT="/etc/apache2"
 -D SUEXEC_BIN="/usr/lib/apache2/suexec"
 -D DEFAULT_PIDLOG="/var/run/apache2.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_LOCKFILE="/var/run/apache2/accept.lock"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="mime.types"
 -D SERVER_CONFIG_FILE="apache2.conf"
root@shkodenko:~#

To view list of compiled-in modules execute:

root@shkodenko:~# apachectl -l
Compiled in modules:
  core.c
  mod_log_config.c
  mod_logio.c
  mod_version.c
  prefork.c
  http_core.c
  mod_so.c
root@shkodenko:~#

To check web server Apache syntax run:

root@shkodenko:~# apachectl configtest
Syntax OK
root@shkodenko:~#

To restart web server Apache gracefully run command:

root@shkodenko:~# apachectl graceful

List files and folders inside Java jar archive

To list files and folders inside Java jar archive use unzip.

Look at example below:

# unzip -l /home/taras/Downloads/clientControl.jar |more
Archive:  /home/taras/Downloads/clientControl.jar
  Length      Date    Time    Name
---------  ---------- -----   ----
        0  02-16-2014 12:10   META-INF/
      106  02-16-2014 12:10   META-INF/MANIFEST.MF
        0  02-16-2014 12:10   database/
        0  02-16-2014 12:10   i18n/
        0  02-16-2014 12:10   lib/
        0  02-16-2014 12:10   web/
        0  02-16-2014 12:10   web/WEB-INF/
        0  02-16-2014 12:10   web/images/
        0  02-16-2014 12:10   web/style/
     2052  02-16-2014 12:10   changelog.html
      926  02-16-2014 12:10   database/clientcontrol_db2.sql
      926  02-16-2014 12:10   database/clientcontrol_hsqldb.sql
      853  02-16-2014 12:10   database/clientcontrol_mysql.sql
      934  02-16-2014 12:10   database/clientcontrol_oracle.sql
      926  02-16-2014 12:10   database/clientcontrol_postgresql.sql
      940  02-16-2014 12:10   database/clientcontrol_sqlserver.sql
      518  02-16-2014 12:10   database/import_db2.sql
      518  02-16-2014 12:10   database/import_hsqldb.sql
      518  02-16-2014 12:10   database/import_mysql.sql
      531  02-16-2014 12:10   database/import_oracle.sql
      518  02-16-2014 12:10   database/import_postgresql.sql
      518  02-16-2014 12:10   database/import_sqlserver.sql
     9970  02-16-2014 12:10   i18n/clientcontrol_i18n.properties
    21675  02-16-2014 12:10   i18n/clientcontrol_i18n_cs_CZ.properties
    20526  02-16-2014 12:10   i18n/clientcontrol_i18n_es.properties
    18680  02-16-2014 12:10   i18n/clientcontrol_i18n_fr.properties
    20470  02-16-2014 12:10   i18n/clientcontrol_i18n_pt_BR.properties
    23402  02-16-2014 12:10   i18n/clientcontrol_i18n_zh_CN.properties
    22379  02-16-2014 12:10   lib/commons-fileupload-1.0.jar
    55527  02-16-2014 12:10   lib/plugin-clientControl-jspc.jar
    37248  02-16-2014 12:10   lib/plugin-clientControl.jar
      814  02-16-2014 12:10   logo_large.gif
      592  02-16-2014 12:10   logo_small.gif
     2074  02-16-2014 12:10   plugin.xml
     4225  02-16-2014 12:10   readme.html
      636  02-16-2014 12:10   web/WEB-INF/web-custom.xml
     3964  02-16-2014 12:10   web/WEB-INF/web.xml
     2674  02-16-2014 12:10   web/images/certificateimg_error.gif
     2673  02-16-2014 12:10   web/images/certificateimg_warning.gif
     1049  02-16-2014 12:10   web/images/client-icon_adium.gif
      552  02-16-2014 12:10   web/images/client-icon_exodus.gif
     1033  02-16-2014 12:10   web/images/client-icon_ichat.gif
      363  02-16-2014 12:10   web/images/client-icon_jbother.gif
       94  02-16-2014 12:10   web/images/client-icon_pandion.gif
      592  02-16-2014 12:10   web/images/client-icon_pidgin.gif
      687  02-16-2014 12:10   web/images/client-icon_psi.gif
      591  02-16-2014 12:10   web/images/client-icon_spark.gif
      996  02-16-2014 12:10   web/images/client-icon_trillian.gif
      546  02-16-2014 12:10   web/images/icon_error.gif
      237  02-16-2014 12:10   web/images/icon_help_14x14.gif
      415  02-16-2014 12:10   web/images/icon_warning-small.gif
      538  02-16-2014 12:10   web/images/icon_warning.gif
      645  02-16-2014 12:10   web/images/mac.gif
       51  02-16-2014 12:10   web/images/reports_selected-arrow.gif
     1015  02-16-2014 12:10   web/images/win.gif
      241  02-16-2014 12:10   web/images/zip.gif
     7006  02-16-2014 12:10   web/style/style.css
---------                     -------
   274964                     57 files

Unable to start MySQL service. Another MySQL daemon is already running with the same UNIX socket

Š•verything happens for the first time ever.

Today, first time I have seen such MySQL service error during start: Unable to start MySQL service. Another MySQL daemon is already running with the same UNIX socket.

First item to check: main MySQL service log /var/log/mysqld.log and main configuration file /etc/my.cnf

Then I have found nice KB article on Rackspace: http://kb.parallels.com/en/119334

It has helped me to solve this problem.

I have runned command to kill all possible running MySQL daemons:

# killall -9 mysqld_safe mysqld

And then I have made changes below to MySQL service startup script /etc/init.d/mysqld:

# cp -fv /etc/init.d/mysqld /etc/init.d/mysqld.orig
# diff -c /etc/init.d/mysqld.orig /etc/init.d/mysqld

+       # We check if there is already a process using the socket file,
+       # since otherwise this init script could report false positive
+       # result and mysqld_safe would remove the socket file, which
+       # actually uses a different daemon.
+       if fuser "$socketfile" &>/dev/null ; then
+           echo "Socket file $socketfile exists. Is another MySQL daemon already running with the same unix socket?"
+           action $"Starting $prog: " /bin/false
+           return 1
+       fi

-       if [ -S "$socketfile" ] ; then
-           echo "Another MySQL daemon already running with the same unix socket."
-           action $"Starting $prog: " /bin/false
-           return 1
-       fi

Then I have started MySQL server using command:

# /etc/init.d/mysqld start

There is another method to fix problems with MySQL server error:
Another MySQL daemon already running with the same unix socket

Run command:

# rm -fv $(grep socket /etc/my.cnf | cut -d= -f2) && /sbin/service mysqld start

Both of methods listed above has solved MySQL issues for me.

Plesk 11.0.9 for Linux: fix failed automatic update

If you can`t start Plesk 11.0.9 control panel for Linux using command:

# /sbin/service psa start

after failed automatic upgrade you can fix it using command:

# /usr/local/psa/bootstrapper/pp11.0.9-bootstrapper/bootstrapper.sh repair

Example commnad output:
Changing shell for popuser.
Shell not changed.
Changing shell for mhandlers-user.
Shell not changed.
===> Preparing upgrade
Stopping psa… done
psa is stopped
Stopping psa… done
===> Cumulative database upgrade has been started
===> Upgrade completed.
mknod: `/var/www/vhosts/chroot/dev/null’: File exists
===> Cumulative upgrade has been started
===> Upgrade completed.
Stopping psa… done
Starting xinetd service… done
Starting mysqld service… done
Starting named service… done
Starting postgresql service… not installed
Starting psa-spamassassin service… not installed
Plesk: Starting Mail Server… already started
Starting psa… done
Starting drwebd service… done

Congratulations!
All stages of the upgrade were successful.
psa is now running on your system.
To complete the system configuration process, please proceed to URL:
https://shkodenko.com:8443/ or
https://88.198.37.179:8443/
Use ‘admin’ and ‘‘ as login name and password.

Further, use the following commands to start and stop the system:
/etc/init.d/psa start and
/etc/init.d/psa stop respectively.

It should fix post-upgrade issues.
Related KB article: http://kb.parallels.com/en/116078

Warning during restart mysqld service Using unique option prefix pass instead of password is deprecated

If you getting
Warning: Using unique option prefix pass instead of password is deprecated and will be removed in a future release. Please use the full name instead.
during mysqld service restart you should fix your custom ~/.my.cnf configuration files syntax.

# more ~/.my.cnf
[client]
user=”root”
pass=”YourSecureMySQLPassword”
#

short “pass” should be removed by “password”:

password=”YourSecureMySQLPassword”

Plesk 11.5.30 for Linux post Update #26 error

During Plesk control panel version 11.5.30 for Linux when updated to #26 I got error:

ERROR: PleskFatalException: Unable to connect to database: mysql_connect(): No such file or directory (auth.php:142)

When I have checked KB articles related to this problem on suggested link Search for related Knowledge Base articles

I have found working solution:

# export PSA_PASSWORD='MySecurePleskPassword'
# echo $PSA_PASSWORD
MySecurePleskPassword
# /usr/local/psa/admin/bin/ch_admin_passwd