centos: Another MySQL daemon already running with the same unix socket
I have a strange error when starting mysqld service
«Another MySQL daemon already running with the same unix socket.»
I’ve tried to list running services and stopping them but the same error happens when starting mysqld service
by the way I may remove the mysqld and reinstall it but will this remove the database too ?
your help is very appreciated
Solution:
To prevent the problem from occurring, you must perform a graceful shutdown of the server from the command line rather than powering off the server.
# shutdown -h now
This will stop the running services before powering down the machine.
Based on Centos, an additional method for getting it back up again when you run into this problem is to move mysql.sock:
# mv /var/lib/mysql/mysql.sock /var/lib/mysql/mysql.sock.bak
# service mysqld start
Restarting the service creates a new entry called mqsql.sock
Ver tráfico interface red en VMWare & Linux host
Primero activar el modo promiscuo en los adaptadores de red de VMWare: aká: http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1004099
Segundo: desde el Shell de un guest en Linux con privilegios root, ejecutar: «tcpdump -env -ttt -i <interface de red> host <ip a sniffar>»
p.e:
– «tcpdump -env -ttt -i eth0 host 192.168.0.169»
– «tcpdump -env -ttt -i eth0 host 192.168.0.169 and port 445»
Linux increasing or decreasing TCP sockets timeouts (suse rcp connection timeout)
Fuente: http://www.cyberciti.biz/tips/linux-increasing-or-decreasing-tcp-sockets-timeouts.HTML
Fuente: http://www.cyberciti.biz/faq/making-changes-to-proc-filesystem-permanently/
Some time it is necessary to increase or decrease timeouts on TCP sockets. You can use /proc/sys/net/ipv4/tcp_keepalive_time to setup new value.
The number of seconds a connection needs to be idle before TCP begins sending out keep-alive probes. Keep-alives are only sent when the SO_KEEPALIVE socket option is enabled. The default value is 7200 seconds (2 hours).
For example set value to 2400 seconds:
echo 2400 > /proc/sys/net/ipv4/tcp_keepalive_time
You can make changes to /proc filesystem permanently using /etc/sysctl.conf
Further reading
- See man page of ip(7) and tcp(7) for more details.
- Securing and Optimizing Linux book (by OpenNA), network optimization chapter
CentOS & mutt: instalación y configuración
En esta entrada vamos a instalar y configurar correctamente el envío de emails autenticados desde la línea de comandos.
Supongamos que haremos el envío desde el usuario linux «backups»
1- Instalar cliente de correo electrónico para enviar emails desde la línea de comandos
Instalar mutt
#sudo yum install mutt
2- configuración del fichero de mutt para la autenticación del email
guardar el fichero en el home del usuario, p.e. ~/backups/.muttrc
—-inicio susodicho fichero———–
set from = «backups@midominio.com»
set realname = «backups de midominio»
set imap_user = «backups@midominio.com»
set imap_pass = «blablabla»
set folder = «imaps://imap.1and1.es:993»
set spoolfile = «+INBOX»
set header_cache =~/.mutt/cache/headers
set message_cachedir =~/.mutt/cache/bodies
set smtp_url = «smtp://backups@midominio.com@smtp.1and1.es/»
set smtp_pass = «blablabla»
set from = «backups@midominio.com»
set move = no
set imap_keepalive = 900
—-final susodicho fichero———–
3- Es posible que en función de la plataforma, mutt devuelva un pete de error (p.e. “violación de segmento”, “Permission denied”, etc… . Para solventar este problema:
a) copy cp /etc/Muttrc to your users home directory and rename the file .muttrc-1.5.20
cp /etc/Muttrc /home/<usuario>/.muttrc-1.5.20
b) Assisgn the .muttrc-1.5.20 file the necessary permissions
chown <usuario>: <usuario> /home/<usuario>/.muttrc-1.5.20
c) open the file with your favorite text editor.
vi .muttrc-1.5.20
d) now replace Quote:
#set tmpdir=»»
with
Quote:
set tmpdir=»/tmp»
e) et voilà !
4- Verificar el envío desde la lína de comandos:
$ mutt -s «<subject>» -a <ruta y fichero a anexar> — <email destinatario> < ruta y fichero con el contenido del cuerpo del mensaje>
CentOS & dropbox: instalación completa
1- (root) Creación usuario dropbox en centOS:
# useradd -s /bin/bash dropbox
# passwd dropbox
Nueva contraseña: xxxxxx
2- (root) Crear grupo para administración
# groupadd -r admin
3- (root)…Y para asignar un grupo creado a un usuario existente en el sistema operativo:
# gpasswd -a dropbox admin
4- (root) Añadir permisos sudo para el usuario dropbox
# visudo
… y añadir al final del fichero
%admin ALL=(ALL) ALL
5- instalación dropbox (con la cuenta usuario “dropbox”):
5.1- descargar e instalar la versión 64-bit:
cd ~ && wget -O – «https://www.dropbox.com/download?plat=lnx.x86_64» | tar xzf –
5.2- ejecutar el instalador. Es requisito que previamente esté dado de alta en dropbox, y la primera vez Solicitará ejecutar un enlace para vincular la cuenta del servicio local con dropbox.
~/.dropbox-dist/dropboxd
5.3- En la cónsola aparecerá una URL a visitar para realizar la vinculación con la cuenta de dropbox: https://www.dropbox.com/cli_link?host_id=host_id donde HOST_ID es el número de 128 bits correspondiente a nuestro identificador. Copiar toda la url completa ya que accederemos posteriormente para vincular la cuenta.
5.4 Desde un navegador, abrir la sesión correspondiente a la cuenta que queremos vincular con el equipo. Con la sesión abierta, en el navegador pegar la url completa obtenida en la cónsola Linux del paso anterior y acceder a dicha url. En dropbox solicitará de nuevo la contraseña de la cuenta creada previamente.
5.4- Una vez vinculadas las cuentas, tanto en la cónsola como en el navegador saldrá un breve mensaje que confirma que se han vinculado correctamente la cuentas.Comprobar si tenemos dropbox funcionando a estas alturas:
ps -ef |grep dropbox
… deberá salir una línea parecida:
dropbox 2926 2779 1 10:02 pts/2 00:00:05 /home/dropbox/.dropbox-dist/dropbox
6- Si queremos compartir las carpetas de otra aplicación o usuario, modificar los permisos de dicha carpeta para que el usuario «dropbox» tenga acceso
(en plan bestia…) chmod 777 /home/<usuario>
7- accede con la cuenta “dropbox” y crear enlaces simbólicos
# ln -s /home/<usuario>/fitxers / home /dropbox/Dropbox
# ln -s /home/<usuario>/irpf / home /dropbox/Dropbox
# ln -s /home/<usuario>/templates / home /dropbox/Dropbox
# ln -s /home/<usuario>/winsuite /home/dropbox/Dropbox
8- Con el usuario “root”, crear el script que de soporte como servicio a dropbox (gestionar servicio como /etc/init.d/dropbox {start-stop-status-restart})
copiar este script en /etc/init.d/dropbox y dar permisos de ejecución
poner en la variable DROPBOX_USERS=»dropbox» el usuario sobre el que se tiene arrancar el servicio dropbox (si hubiera más de uno, separarlos por espacios)
#——— inicio del susodicho script ————-
# chkconfig: 345 85 15
# description: Startup script for dropbox daemon
#
# processname: dropboxd
# pidfile: /var/run/dropbox.pid
# config: /etc/sysconfig/dropbox
#
### BEGIN INIT INFO
# Provides: dropboxd
# Required-Start: $local_fs $network $syslog
# Required-Stop: $local_fs $syslog
# Should-Start: $syslog
# Should-Stop: $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start up the Dropbox file syncing daemon
# Description: Dropbox is a filesyncing sevice provided by dropbox.com
# This service starts up the dropbox daemon.
### END INIT INFO
# Source function library.
. /etc/rc.d/init.d/functions
# To configure, add line with DROPBOX_USERS=»user1 user2″ to /etc/sysconfig/dropbox
# Probably should use a dropbox group in /etc/groups instead.
DROPBOX_USERS=»dropbox»
# [ -f /etc/sysconfig/dropbox ] && . /etc/sysconfig/dropbox
prog=dropboxd
lockfile=${LOCKFILE-/var/lock/subsys/$prog}
config=${CONFIG-/etc/sysconfig/dropbox}
RETVAL=0
start() {
echo -n $»Starting $prog»
if [ -z $DROPBOX_USERS ] ; then
echo -n «: unconfigured: $config»
echo_failure
echo
rm -f ${lockfile} ${pidfile}
RETURN=6
return $RETVAL
fi
for dbuser in $DROPBOX_USERS; do
dbuser_home=`cat /etc/passwd | grep «$dbuser» | cut -d»:» -f6`
daemon –user $dbuser /bin/sh -c «$dbuser_home/.dropbox-dist/dropboxd&»
done
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch ${lockfile}
return $RETVAL
}
status() {
for dbuser in $DROPBOX_USERS; do
dbpid=`pgrep -u $dbuser dropbox | grep -v grep`
if [ -z $dbpid ] ; then
echo «dropboxd for USER $dbuser: not running.»
else
echo «dropboxd for USER $dbuser: running (pid $dbpid)»
fi
done
}
stop() {
echo -n $»Stopping $prog»
for dbuser in $DROPBOX_USERS; do
dbuser_home=`cat /etc/passwd | grep «^$dbuser:» | cut -d»:» -f6`
killproc $dbuser_home/.dropbox-dist/dropbox
done
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
}
# See how we were called.
case «$1″ in
start)
start
;;
status)
status
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo $»Usage: $prog {start|status|stop|restart}»
RETVAL=3
esac
exit $RETVAL
#——— fin del susodicho script ————-
8.1- asignar permisos de ejecución a este fichero:
chmod 755 /etc/init.d/dropbox
9- Con la cuenta “dropbox”, incorporar a crontab el arranque automático de dropbox como servicio
chkconfig –add dropbox
chkconfig dropbox on
How to send email from the command line – Gmail Mutt
Fuente: http://go2linux.garron.me/linux/2010/10/how-send-email-command-line-gmail-mutt-789
Para errores, consultar: http://www.centos.org/modules/newbb/viewtopic.php?topic_id=40210&forum=56
And sending email while working on the command line, is good, I use it to send me notes to myself, and sometimes to send configuration files as attachments.
Is also good to have an option configured to send emails from the command line, as a way to send messages from scripts.
I will show you now how to use mutt and gmail to enable a Linux computer to send email.
Install mutt
Arch Linux
sudo pacman -S mutt
Ubuntu
sudo aptitude install mutt
Configure mutt
To configure it, we need to create ~./muttrc
and put inside the file this contents
set from = "user@gmail.com" set realname = "Guillermo Garron" set imap_user = "user@gmail.com" set imap_pass = "password" set folder = "imaps://imap.gmail.com:993" set spoolfile = "+INBOX" set postponed ="+[Gmail]/Drafts" set header_cache =~/.mutt/cache/headers set message_cachedir =~/.mutt/cache/bodies set certificate_file =~/.mutt/certificates set smtp_url = "smtp://user@smtp.gmail.com:587/" set smtp_pass = "password" set move = no set imap_keepalive = 900
Create the folders
mkdir -p /.mutt/cache
Change, for your user and your password, and you are done.
Sending emails
Now that mutt is configured it is ready to start sending emails.
mutt -s "Test from mutt" user@yahoo.com < /tmp/message.txt
And if you need to send an attachment
mutt -s "Test from mutt" user@yahoo.com < /tmp/message.txt -a /tmp/file.jpg
*-s «Test from mutt»* is the subject *-a /tmp/file.jpg* is the attachment */tmp/message.txt* is the message itself This is another way to write the test, having the body in the same line.
echo "This is the body" | mutt -s "Testing mutt" user@yahoo.com -a /tmp/XDefd.png
If you need to use send emails from a script, just use that line in the script, but be sure that is the user that has the `.muttrc` file in his / her home directory the one that runs the script.
If you liked this article please share it.
Instalar como servicio dropbox en ambiente Linux
Fuente: http://archive.ianwinter.co.uk/2011/05/16/centos-and-dropbox/
Fuente: http://ubuntuservergui.com/ubuntu-server-guide/install-dropbox-ubuntu-server
Una vez hecho todos los pasos, incorporar a crontab el arranque automático de dropbox como servicio
@reboot <ruta usuario dropbox>/.dropbox-dist/dropboxd
Just because I can really I setup Dropbox syncing on one of my CentOS 5 servers. It’s a little bit of a faff, but, not that hard. The official guide is online, but, this is a shorten version and might not cover everything but it worked on my headless VM just fine.
First up su to whichever user you want to install Dropbox as. You’ll need two terminal’s open so fire them both up now. You’ll also need lynx, gcc and python installed so if you don’t have, sort that out with yum.
In your home directory grab the correct binary for you (x86 or x86_64).
1
2
|
wget -O dropbox.tar.gz http://www.dropbox.com/download/?plat=lnx.x86 wget -O dropbox.tar.gz http://www.dropbox.com/download/?plat=lnx.x86_64 |
Now unpack it and start it up in your first terminal window.
1
2
|
tar xvfz dropbox.tar.gz ~/.dropbox-dist/dropboxd |
Now in your second terminal go to http://dropbox.com using lynx (lynx http://dropbox.com) and login, then using the key shortcut “g” paste in the URL that your first window should now be prompted you to go to. This is to register the machine with your Dropbox account. You’ll need to scroll down the page to re-enter your password. Once done the first window should say hello to you and it’ll quit.
Next up sort out the init.d script. Put the following in /etc/init.d/dropbox and chown 755 it when you’re done.
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
# chkconfig: 345 85 15 # description: Startup script for dropbox daemon # # processname: dropboxd # pidfile: /var/run/dropbox.pid # config: /etc/sysconfig/dropbox # ### BEGIN INIT INFO # Provides: dropboxd # Required-Start: $local_fs $network $syslog # Required-Stop: $local_fs $syslog # Should-Start: $syslog # Should-Stop: $network $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start up the Dropbox file syncing daemon # Description: Dropbox is a filesyncing sevice provided by dropbox.com # This service starts up the dropbox daemon. ### END INIT INFO # Source function library. . /etc/rc.d/init.d/functions # To configure, add line with DROPBOX_USERS="user1 user2" to /etc/sysconfig/dropbox # Probably should use a dropbox group in /etc/groups instead. [ -f /etc/sysconfig/dropbox ] && . /etc/sysconfig/dropbox prog=dropboxd lockfile=${LOCKFILE-/var/lock/subsys/$prog} config=${CONFIG-/etc/sysconfig/dropbox} RETVAL=0 start() { echo -n $"Starting $prog" if [ -z $DROPBOX_USERS ] ; then echo -n ": unconfigured: $config" echo_failure echo rm -f ${lockfile} ${pidfile} RETURN=6 return $RETVAL fi for dbuser in $DROPBOX_USERS; do daemon --user $dbuser /bin/sh -c "/home/$dbuser/.dropbox-dist/dropboxd&" done RETVAL=$? echo [ $RETVAL = 0 ] && touch ${lockfile} return $RETVAL } status() { for dbuser in $DROPBOX_USERS; do dbpid=`pgrep -u $dbuser dropbox | grep -v grep` if [ -z $dbpid ] ; then echo "dropboxd for USER $dbuser: not running." else echo "dropboxd for USER $dbuser: running (pid $dbpid)" fi done } stop() { echo -n $"Stopping $prog" for dbuser in $DROPBOX_USERS; do killproc /home/$dbuser/.dropbox-dist/dropbox done RETVAL=$? echo [ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile} } # See how we were called. case "$1" in start) start ;; status) status ;; stop) stop ;; restart) stop start ;; *) echo $"Usage: $prog {start|status|stop|restart}" RETVAL=3 esac exit $RETVAL |
Edit /etc/sysconfig/dropbox and add the following line to match your linux account where you’ve installed Dropbox.
1
|
DROPBOX_USERS="linux_user_name" |
Make sure it starts on boot.
1
|
chkconfig dropbox on. |
That’s it. Enjoy.
-
Jan van der Lugt • a day ago Great script! Better yet, only grep if $dbuser occurs at the start of the line and ends with a semicolon (to avoid matching of a partial username). Same fix for stopping.
45c45,46
< daemon –user $dbuser /bin/sh -c «/home/$dbuser/.dropbox-dist/dropboxd&»
—
> dbuser_home=`cat /etc/passwd | grep «^$dbuser:» | cut -d»:» -f6`
> daemon –user $dbuser /bin/sh -c «$dbuser_home/.dropbox-dist/dropboxd&»
67c68,69
< killproc /home/$dbuser/.dropbox-dist/dropbox
—
> dbuser_home=`cat /etc/passwd | grep «^$dbuser:» | cut -d»:» -f6`
> killproc $dbuser_home/.dropbox-dist/dropbox - 0
- •
- Reply
- •
- Share ›
-
Simon Inglis • 8 months ago Thanks for the script. Here’s a minor improvement to handle user home directories that aren’t under /home (as is the case with my Jenkins install)
45c45,46
dbuser_home=`cat /etc/passwd | grep «$dbuser» | cut -d»:» -f6`
> daemon –user $dbuser /bin/sh -c «$dbuser_home/.dropbox-dist/dropboxd&» - 0
- •
- Reply
- •
- Share ›
-
steve • a year ago merci!
Put the above in /etc/init.d/dropbox and chmod 755 it when you’re done.
not chown;
thank you! - 0
- •
- Reply
- •
- Share ›
-
Robert Son Hedler • a year ago Thank you very much, it works very well!!!