clamav-daemon doesn't create /var/run/clamd.ctl [closed] - linux

Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 3 days ago.
Improve this question
I installed clamav-daemon on Debian 11 and when I try to start it, it doesn't create the LocalSocket /var/run/clamd.ctl.
LocalSocket in my /etc/clamav/clamd.conf:
LocalSocket /var/run/clamav/clamd.ctl
systemctl status clamav-daemon.service brings:
● clamav-daemon.service - Clam AntiVirus userspace daemon
Loaded: loaded (/lib/systemd/system/clamav-daemon.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/clamav-daemon.service.d
└─extend.conf, override.conf
Active: active (running) since Fri 2023-02-17 15:55:18 CET; 34min ago
Docs: man:clamd(8)
man:clamd.conf(5)
https://docs.clamav.net/
Process: 37394 ExecStartPre=/bin/mkdir -p /run/clamav (code=exited, status=0/SUCCESS)
Process: 37395 ExecStartPre=/bin/chown clamav /run/clamav (code=exited, status=0/SUCCESS) Main PID: 37396 (clamd)
Tasks: 1 (limit: 1129)
Memory: 489.8M
CPU: 52.996s
CGroup: /system.slice/clamav-daemon.service
└─37396 /usr/sbin/clamd --foreground=true
Feb 17 15:55:18 cc700x-irmler systemd[1]: clamav-daemon.service:
Consumed 11.193s CPU time. Feb 17 15:55:18 cc700x-irmler systemd[1]:
Starting Clam AntiVirus userspace daemon... Feb 17 15:55:18
cc700x-irmler systemd[1]: Started Clam AntiVirus userspace daemon.
So, it seems everything to be fine. But:
systemctl status clamav-daemon.socket brings:
Unit clamav-daemon.socket could not be found.
/var/log/clamav/clamav.log brings (when starting):
Fri Feb 17 15:55:19 2023 -> +++ Started at Fri Feb 17 15:55:19 2023
Fri Feb 17 15:55:19 2023 -> Received 0 file descriptor(s) from
systemd. Fri Feb 17 15:55:19 2023 -> clamd daemon 0.103.7 (OS:
linux-gnu, ARCH: x86_64, CPU: x86_64) Fri Feb 17 15:55:19 2023 -> Log
file size limited to 4294967295 bytes. Fri Feb 17 15:55:19 2023 ->
Reading databases from /var/lib/clamav Fri Feb 17 15:55:19 2023 -> Not
loading PUA signatures. Fri Feb 17 15:55:19 2023 -> Bytecode: Security
mode set to "TrustSigned". Fri Feb 17 16:08:12 2023 -> Loaded 8652992
signatures.
/var/log/clamav/clamav-milter.log brings (as the /var/run/clamav/clamd.ctl is missing):
Fri Feb 17 16:27:05 2023 -> WARNING: No clamd server appears to be
available Fri Feb 17 16:28:05 2023 -> WARNING: No clamd server appears
to be available Fri Feb 17 16:29:04 2023 -> WARNING: No clamd server
appears to be available Fri Feb 17 16:30:03 2023 -> WARNING: No clamd
server appears to be available Fri Feb 17 16:31:02 2023 -> WARNING: No
clamd server appears to be available Fri Feb 17 16:32:01 2023 ->
WARNING: No clamd server appears to be available
The permissions for /var/run/ is set for the user "clamav" and group "root". clamav is also the user who runs the process:
ps aux | grep clamav
clamav 500 0.0 0.0 58248 704 ? Ss 14:22 0:00
/usr/bin/freshclam -d --foreground=true clamav 31064 0.0 0.0
349480 52 ? Ssl 14:55 0:00 /usr/sbin/clamav-milter
--config-file=/etc/clama v/clamav-milter.conf clamav 37396 2.2 42.5 1395520 425952 ? Ds 15:55 0:55 /usr/sbin/clamd --foreground=true root 38870 0.0 0.0 6244 700 pts/1 S+ 16:36 0:00 grep clamav
I tried already to purge/install and also --reinstall clamav and clamav-daemon and I also tried a dpkg-reconfigure on clamav-daemon. And I also tried a clean reboot. Nothing changed the situation.
I have no idea what else I could try. Has anyone an idea?
Thanks a lot!

Related

Mongodb service fails after reboot

I am trying to setup a replicaset for my dev environment, and have three machines running debian 9.3 stretch with a mongod service. The replicaset is working, and all seems okay.
But when I reboot one of the servers the mongod service doesn't come up. When I check the status it says it failed status=48
mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2018-08-28 22:17:37 CEST; 10s ago
Docs: https://docs.mongodb.org/manual
Process: 392 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=48)
Main PID: 392 (code=exited, status=48)
CPU: 33ms
aug 28 22:17:37 staging-manager-1 systemd[1]: Started MongoDB Database Server.
aug 28 22:17:37 staging-manager-1 mongod[392]: 2018-08-28T22:17:37.389+0200 I CONTROL [main] Automatically disabling TLS 1.0, to fo
aug 28 22:17:37 staging-manager-1 systemd[1]: mongod.service: Main process exited, code=exited, status=48/n/a
aug 28 22:17:37 staging-manager-1 systemd[1]: mongod.service: Unit entered failed state.
aug 28 22:17:37 staging-manager-1 systemd[1]: mongod.service: Failed with result 'exit-code'.
I already enabled the service with systemctl enable mongod and in the status I can see that it is indeed enabled, but why does it fail after I reboot the machine?
update:
root#machine:/home/<user># journalctl -u mongod
-- Logs begin at Thu 2018-08-30 21:11:33 CEST, end at Thu 2018-08-30 21:26:42 CEST. --
aug 30 21:11:33 staging-manager-1 systemd[1]: Started MongoDB Database Server.
aug 30 21:11:33 staging-manager-1 mongod[398]: 2018-08-30T21:11:33.388+0200 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
aug 30 21:11:33 staging-manager-1 systemd[1]: mongod.service: Main process exited, code=exited, status=48/n/a
aug 30 21:11:33 staging-manager-1 systemd[1]: mongod.service: Unit entered failed state.
aug 30 21:11:33 staging-manager-1 systemd[1]: mongod.service: Failed with result 'exit-code'.
root#machine:/home/<user># ll /etc/init
total 48
-rw-r--r-- 1 root root 278 mei 29 2017 anacron.conf
-rw-r--r-- 1 root root 1875 jul 18 21:01 docker.conf
-rw-r--r-- 1 root root 2493 jun 2 2015 networking.conf
-rw-r--r-- 1 root root 933 jun 2 2015 network-interface.conf
-rw-r--r-- 1 root root 530 jun 2 2015 network-interface-container.conf
-rw-r--r-- 1 root root 1756 jun 2 2015 network-interface-security.conf
-rw-r--r-- 1 root root 1359 mrt 14 2017 sddm.conf
-rw-r--r-- 1 root root 637 mrt 1 13:36 ssh.conf
-rw-r--r-- 1 root root 337 jun 13 22:20 udev.conf
-rw-r--r-- 1 root root 360 jun 13 22:20 udevmonitor.conf
-rw-r--r-- 1 root root 352 jun 13 22:20 udevtrigger.conf
-rw-r--r-- 1 root root 138 jan 23 2017 usb-modeswitch-upstart.conf
root#machine:/home/<user># ll /etc/init.d
total 168
-rwxr-xr-x 1 root root 5336 feb 1 2016 alsa-utils
-rwxr-xr-x 1 root root 2014 mei 29 2017 anacron
-rwxr-xr-x 1 root root 8181 apr 5 20:32 apache2
-rwxr-xr-x 1 root root 2489 mei 13 18:52 apache-htcacheclean
-rwxr-xr-x 1 root root 2401 jan 23 2017 avahi-daemon
-rwxr-xr-x 1 root root 2948 sep 13 2017 bluetooth
-rwxr-xr-x 1 root root 1904 nov 18 2015 cgroupfs-mount
-rwxr-xr-x 1 root root 1232 apr 7 2017 console-setup.sh
-rwxr-xr-x 1 root root 3049 okt 7 2017 cron
-rwxr-xr-x 1 root root 2816 jul 10 15:57 cups
-rwxr-xr-x 1 root root 1961 jan 19 2017 cups-browsed
-rwxr-xr-x 1 root root 2813 mrt 2 09:59 dbus
-rwxr-xr-x 1 root root 3843 jul 18 21:01 docker
-rwxr-x--- 1 root root 4285 jul 20 07:27 elasticsearch
-rwxr-xr-x 1 root root 3033 aug 9 21:30 gdm3
-rwxr-xr-x 1 root root 1604 feb 2 2017 gdomap
-rwxr-xr-x 1 root root 3809 mrt 7 19:29 hwclock.sh
-rwxr-xr-x 1 root root 1479 mei 19 2016 keyboard-setup.sh
-rwxr-xr-x 1 root root 2044 dec 26 2016 kmod
-rwxr-xr-x 1 root root 2241 apr 26 2017 minissdpd
-rwxr-xr-x 1 root root 4597 sep 16 2016 networking
-rwxr-xr-x 1 root root 1757 mrt 18 2017 network-manager
-rwxr-xr-x 1 root root 612 dec 4 2015 pppd-dns
-rwxr-xr-x 1 root root 1191 mei 17 12:56 procps
-rwxr-xr-x 1 root root 4355 dec 10 2017 rsync
-rwxr-xr-x 1 root root 2868 jan 18 2017 rsyslog
-rwxr-xr-x 1 root root 2330 mei 21 2017 saned
-rwxr-xr-x 1 root root 1222 apr 3 2017 screen-cleanup
-rwxr-xr-x 1 root root 1808 mrt 14 2017 sddm
-rwxr-xr-x 1 root root 2117 aug 2 2017 speech-dispatcher
-rwxr-xr-x 1 root root 2484 okt 12 2016 spice-vdagent
-rwxr-xr-x 1 root root 4033 mrt 1 13:36 ssh
-rwxr-xr-x 1 root root 731 jun 5 2017 sudo
-rwxr-xr-x 1 root root 6087 jun 13 22:20 udev
-rwxr-xr-x 1 root root 1391 mei 6 2017 unattended-upgrades
-rwxr-xr-x 1 root root 2757 nov 23 2016 x11-common
That is the whole output message?
Check if the default mongod port(27017) is not in use.
netstat -a
Or try starting in a different port
mongod --fork --port 8000
MongoDB defines exit code 48 as: "A newly started mongod or mongos could not start listening for incoming connections, due to an error."
You have pasted just the status output for the MongoDB service. For the full logs of a service on a systemd based system, you should review the systemd journal output:
journalctl -u mongod
As Lucca suggested, the problem may be something else is already running on the port when you are trying to start.
Check that you are't also trying to start MongoDB via Upstart or SysVInit by looking for MongoDB files in /etc/init and /etc/init.d. If any are found, move them somewhere else so that only the systemd service file is being used to start the service.
a#a-57:~$ sudo systemctl stop mongod.service
a#a-57:~$ sudo systemctl start mongod.service
a#a-57:~$ sudo systemctl status mongod.service
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2021-08-09 16:38:29 CST; 6s ago
Docs: https://docs.mongodb.org/manual
Main PID: 2205 (mongod)
CGroup: /system.slice/mongod.service
└─2205 /usr/bin/mongod --config /etc/mongod.conf
八 09 16:38:29 a-57 systemd[1]: Started MongoDB Database Server.
Somehow it's dangerous to edit the rc files under /etc in these modern days. And people would prefer to use system command API as we knew.
You need to edit etc/rc.local in order for it to start on boot up
Just add service mongod start to end of the rc.local file

postgresql service not running on RHEL 7

We have an application that is running on RHEL6/32 bit and RHEL6/64 bit. This application uses postgresql 8.4 from the beginning. Now, we want to provide support for this application on RHEL7/64 bit. RHEL7 comes with default postgresql 9.2 in its yum list and this is getting installed and its related services are running properly as well. But after installing postgresql 8.4 on RHEL7, it seems like the services are never running. Please find below the logs:
[root#linpubn218 postgres]# service postgresql status
postgresql.service - SYSV: PostgreSQL database server.
Loaded: loaded (/etc/rc.d/init.d/postgresql)
Active: failed (Result: resources) since Mon 2016-07-25 12:40:28 IST; 2h 0min ago
Docs: man:systemd-sysv-generator(8)
Jul 25 12:40:26 linpubn218.gl.avaya.com systemd[1]: Starting SYSV: PostgreSQL database server....
Jul 25 12:40:28 linpubn218.gl.avaya.com postgresql[26957]: Starting postgresql service: [ OK ]
Jul 25 12:40:28 linpubn218.gl.avaya.com systemd[1]: PID file /var/run/postmaster-8.4.pid not readable (yet?) after start.
Jul 25 12:40:28 linpubn218.gl.avaya.com systemd[1]: Failed to start SYSV: PostgreSQL database server..
Jul 25 12:40:28 linpubn218.gl.avaya.com systemd[1]: Unit postgresql.service entered failed state.
Jul 25 12:40:28 linpubn218.gl.avaya.com systemd[1]: postgresql.service failed.
Jul 25 14:33:45 linpubn218.gl.avaya.com systemd[1]: Unit postgresql.service cannot be reloaded because it is inactive.
Jul 25 14:33:45 linpubn218.gl.avaya.com systemd[1]: Unit postgresql.service cannot be reloaded because it is inactive.
After looking at the logs in journalctl -xe
[root#linpubn218 postgres]# journalctl -xe
Jul 25 14:39:21 linpubn218.gl.avaya.com yum[29260]: Installed: postgresql84-libs-8.4.17-1PGDG.rhel6.x86_64
Jul 25 14:39:45 linpubn218.gl.avaya.com yum[29275]: Installed: postgresql84-8.4.17-1PGDG.rhel6.x86_64
Jul 25 14:40:01 linpubn218.gl.avaya.com useradd[29316]: failed adding user 'postgres', exit code: 9
Jul 25 14:40:02 linpubn218.gl.avaya.com CROND[29320]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Jul 25 14:40:02 linpubn218.gl.avaya.com systemd[1]: Reloading.
Jul 25 14:40:03 linpubn218.gl.avaya.com systemd[1]: Configuration file /usr/lib/systemd/system/auditd.service is marked world-inaccessible. This has no effect as config
Jul 25 14:40:03 linpubn218.gl.avaya.com yum[29309]: Installed: postgresql84-server-8.4.17-1PGDG.rhel6.x86_64
Jul 25 14:42:05 linpubn218.gl.avaya.com polkitd[819]: Registered Authentication Agent for unix-process:29459:43987285 (system bus name :1.292 [/usr/bin/pkttyagent --not
Jul 25 14:42:05 linpubn218.gl.avaya.com systemd[1]: Starting SYSV: PostgreSQL database server....
Jul 25 14:42:06 linpubn218.gl.avaya.com runuser[29473]: pam_unix(runuser-l:session): session closed for user postgres
Jul 25 14:42:08 linpubn218.gl.avaya.com postgresql[29464]: Starting postgresql service: [ OK ]
Jul 25 14:42:08 linpubn218.gl.avaya.com systemd[1]: PID file /var/run/postmaster-8.4.pid not readable (yet?) after start.
Jul 25 14:42:08 linpubn218.gl.avaya.com systemd[1]: Failed to start SYSV: PostgreSQL database server..
Can postgresql 8.4 be installed on RHEL7, which is a systemd based OS? If yes, then what should I do to remove the above error?
I noticed that in /etc/init.d/postgresql-8.4 there is a declared variable:
pidfile="/var/run/postmaster-${PGMAJORVERSION}.${PGPORT}.pid"
But in systemctl, PIDfile is not the same:
# systemctl show postgresql-8.4.service -p PIDFile
PIDFile=/var/run/postmaster-8.4.pid
So, to fix the problem edit /etc/init.d/postgresql-8.4 and replace
pidfile="/var/run/postmaster-${PGMAJORVERSION}.${PGPORT}.pid"
with
pidfile="/var/run/postmaster-${PGMAJORVERSION}.pid"
then reload systemctl:
# systemctl daemon-reload
#/etc/init.d/postgresql-8.4 start
Starting postgresql-8.4 (via systemctl): [ OK ]
Generally permissions caused this type of error
su - postgres
After that:
chmod 700 -R <data_directory>
And you should check SELinux as well.

I want to know if my server was shutdown and time that is shutting down in

i have a server hp with ubuntu server
I want to know if my server was shutdown and time that is shutting down in
there are something to know a logs of my server
You can try the last reboot command to get some basic information about the most recent reboots and the uptime between them.
# last reboot
reboot system boot 2.6.32-431.3.1.e Fri Mar 14 07:02 - 01:51 (8+18:49)
reboot system boot 2.6.32-431.3.1.e Sun Feb 16 02:15 - 06:59 (26+03:44)
reboot system boot 2.6.32-431.3.1.e Sun Jan 26 16:21 - 06:59 (46+13:38)
reboot system boot 2.6.32-358.11.1. Sun Oct 13 18:53 - 16:18 (104+22:25)
reboot system boot 2.6.32-358.11.1. Sun Oct 6 10:10 - 18:50 (7+08:40)
reboot system boot 2.6.32-358.11.1. Sat Jun 29 09:28 - 10:06 (99+00:38)
reboot system boot 2.6.32-358.11.1. Sat Jun 29 09:06 - 09:25 (00:19)
reboot system boot 2.6.32-358.6.2.e Sat Jun 29 08:46 - 09:01 (00:15)

Pass private key password to openvpn command directly in Ubuntu 10.10 [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 5 years ago.
Improve this question
I tried the method with different parameter
I have password.
Here below password is mypassword
1)
root$ echo mypassword || openvpn client.conf.ovpn
the result was display:
mypassword
2)
root$ openvpn client.warriors.conf.ovpn || echo mypassword
the result was display:
Thu Jun 28 00:00:00 2012 us=757575 NOTE: OpenVPN 2.1 requires '--script-security 2' or higher to call user-defined scripts or executables
Enter Private Key Password:
(still need to enter password manualy )
I don't want to have to enter the password manually. How can I achieve this?
3)
DUDE
After running the script it exit out with following:
Fri Jun 29 11:56:59 2012 us=707916 cf_max = 0
Fri Jun 29 11:56:59 2012 us=707925 cf_per = 0
Fri Jun 29 11:56:59 2012 us=707934 max_clients = 1024
Fri Jun 29 11:56:59 2012 us=707944 max_routes_per_client = 256
Fri Jun 29 11:56:59 2012 us=707953 auth_user_pass_verify_script = '[UNDEF]'
Fri Jun 29 11:56:59 2012 us=707963 auth_user_pass_verify_script_via_file = DISABLED
Fri Jun 29 11:56:59 2012 us=707973 ssl_flags = 0
Fri Jun 29 11:56:59 2012 us=707982 port_share_host = '[UNDEF]'
Fri Jun 29 11:56:59 2012 us=707992 port_share_port = 0
Fri Jun 29 11:56:59 2012 us=708001 client = ENABLED
Fri Jun 29 11:56:59 2012 us=708010 pull = ENABLED
Fri Jun 29 11:56:59 2012 us=708020 auth_user_pass_file = '[UNDEF]'
Fri Jun 29 11:56:59 2012 us=708032 OpenVPN 2.1.0 i686-pc-linux-gnu [SSL] [LZO2] [EPOLL] [PKCS11] [MH] [PF_INET6] [eurephia] built on Jul 12 2010
Fri Jun 29 11:56:59 2012 us=708131 NOTE: OpenVPN 2.1 requires '--script-security 2' or higher to call user-defined scripts or executables
Enter Private Key Password:
Fri Jun 29 11:56:59 2012 us=726649 WARNING: this configuration may cache passwords in memory -- use the auth-nocache option to prevent this
Fri Jun 29 11:56:59 2012 us=726805 WARNING: file 'client-team-20110222.key' is group or others accessible
Fri Jun 29 11:56:59 2012 us=727136 /usr/bin/openssl-vulnkey -q -b 1024 -m <modulus omitted>
Fri Jun 29 11:56:59 2012 us=875611 Control Channel MTU parms [ L:1543 D:140 EF:40 EB:0 ET:0 EL:0 ]
Fri Jun 29 11:56:59 2012 us=876742 Data Channel MTU parms [ L:1543 D:1450 EF:43 EB:4 ET:0 EL:0 ]
Fri Jun 29 11:56:59 2012 us=876777 Local Options String: 'V4,dev-type tun,link-mtu 1543,tun-mtu 1500,proto TCPv4_CLIENT,cipher BF-CBC,auth SHA1,keysize 128,key-method 2,tls-client'
Fri Jun 29 11:56:59 2012 us=876788 Expected Remote Options String: 'V4,dev-type tun,link-mtu 1543,tun-mtu 1500,proto TCPv4_SERVER,cipher BF-CBC,auth SHA1,keysize 128,key-method 2,tls-server'
Fri Jun 29 11:56:59 2012 us=876810 Local Options hash (VER=V4): 'd902a8f8'
Fri Jun 29 11:56:59 2012 us=876825 Expected Remote Options hash (VER=V4): '7e078940'
Fri Jun 29 11:56:59 2012 us=877124 NOTE: UID/GID downgrade will be delayed because of --client, --pull, or --up-delay
Fri Jun 29 11:56:59 2012 us=877145 Attempting to establish TCP connection with [AF_INET]89.105.130.193:444 [nonblock]
Fri Jun 29 11:57:00 2012 us=877280 TCP connection established with [AF_INET]89.105.130.193:444
Fri Jun 29 11:57:00 2012 us=877337 Socket Buffers: R=[87380->131072] S=[16384->131072]
Fri Jun 29 11:57:00 2012 us=877353 TCPv4_CLIENT link local: [undef]
Fri Jun 29 11:57:00 2012 us=877364 TCPv4_CLIENT link remote: [AF_INET]89.105.130.193:444
Fri Jun 29 11:57:00 2012 us=877568 TLS: Initial packet from [AF_INET]89.105.130.193:444, sid=c5d843bc e9f3e6ab
Fri Jun 29 11:57:04 2012 us=105788 VERIFY OK: depth=1, /C=IE/ST=NA/L=DUB/O=ABC.OpenVPN/OU=server-terminus/CN=terminus/emailAddress=ops#abc.com
Fri Jun 29 11:57:04 2012 us=106189 VERIFY OK: nsCertType=SERVER
Fri Jun 29 11:57:04 2012 us=106202 VERIFY OK: depth=0, /C=IE/ST=NA/O=abc.OpenVPN/OU=server-terminus/CN=terminus/emailAddress=ops#abc.com
root#bond$
exit in this way is it normal.
In my openvpn.conf:
...
askpass /etc/openvpn/jdoe.pass <<< new line here
ca /etc/openvpn/jdoe_ca.crt
cert /etc/openvpn/jdoe.crt
key /etc/openvpn/jdoe.key
...
The file /etc/openvpn/jdoe.pass just contains the password.
You can chmod this file to 600.
This method save my life... ;-)
Ubuntu 12.04.4 LTS
OpenVPN 2.2.1 x86_64-linux-gnu [SSL] [LZO2] [EPOLL] [PKCS11] [eurephia] [MH] [PF_INET6] [IPv6 payload 20110424-2 (2.2RC2)] built on Mar 13 2014
How about storing it into a file and using --askpass /your/file? --askpass option was added in OpenVPN version 2.0-beta20, Maverick has version 2.1.0-3ubuntu1.
Try a shell script such as:
#!/usr/bin/expect -f
spawn openvpn client.warriors.conf.open
match_max 100000
expect "*?assword:*"
send -- "mypassword"
send -- "\r"
expect eof
You'll need to chmod +x this, you can also set it as an environment variable so you don't have to type out the directory.
Looks like they got this script to work: https://unix.stackexchange.com/questions/9055/establish-openvpn-tunnel-in-bash-script
I think you just swipe | and || operator.
| plug standard output o the previous command to standard input of the next command.
|| launch second command only if first command fail (exit code != 0).
this command should work.
root$ echo mypassword | openvpn client.conf.ovpn

"Hello world" web app and Glassfish crash: address already in use: 8080

From Netbeans 6.9.1 I chose to include Glassfish 3 on install. I then created a new web application and selected JSF 2.0, so Netbeans created a "hello world" type app to start from. However, running it brings up errors, but it's better now that I've modified glassfish a bit. However, why is there still a database problem when I'm not even using a database?
now I'm getting:
glassfish:
Mar 2, 2011 8:49:36 PM com.sun.enterprise.glassfish.bootstrap.ASMain main
INFO: Launching GlassFish on Felix platform
Welcome to Felix
================
INFO: Perform lazy SSL initialization for the listener 'http-listener-2'
INFO: Starting Grizzly Framework 1.9.18-o - Wed Mar 02 20:50:51 PST 2011
INFO: Starting Grizzly Framework 1.9.18-o - Wed Mar 02 20:50:51 PST 2011
INFO: Grizzly Framework 1.9.18-o started in: 1122ms listening on port 7676
INFO: Grizzly Framework 1.9.18-o started in: 1606ms listening on port 8181
INFO: Grizzly Framework 1.9.18-o started in: 1821ms listening on port 8081
INFO: Grizzly Framework 1.9.18-o started in: 1491ms listening on port 3700
INFO: Grizzly Framework 1.9.18-o started in: 1537ms listening on port 4848
INFO: GlassFish Server Open Source Edition 3.0.1 (22) startup time : Felix(67028ms) startup services(17874ms) total(84902ms)
INFO: Binding RMI port to *:8686
INFO: JMXStartupService: Started JMXConnector, JMXService URL = service:jmx:rmi://tleilax.servebeer.com:8686/jndi/rmi://tleilax.servebeer.com:8686/jmxrmi
INFO: Hibernate Validator bean-validator-3.0-JBoss-4.0.2
INFO: Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
INFO: Grizzly Framework 1.9.18-o started in: 266ms listening on port 8081
INFO: Using com.sun.enterprise.transaction.jts.JavaEETransactionManagerJTSDelegate as the delegate
INFO: [Thread[GlassFish Kernel Main Thread,5,main]] started
INFO: {felix.fileinstall.poll (ms) = 5000, felix.fileinstall.dir = /home/thufir/glassfish-3.0.1/glassfish/modules/autostart, felix.fileinstall.debug = 1, felix.fileinstall.bundles.new.start = true, felix.fileinstall.tmpdir = /tmp/fileinstall-8585686048027063971, felix.fileinstall.filter = null}
INFO: Installed /home/thufir/glassfish-3.0.1/glassfish/modules/autostart/osgi-web-container.jar
INFO: Installed /home/thufir/glassfish-3.0.1/glassfish/modules/autostart/org.apache.felix.fileinstall-autodeploy-bundles.cfg
INFO: Installed /home/thufir/glassfish-3.0.1/glassfish/modules/autostart/org.apache.felix.scr.jar
INFO: {felix.fileinstall.poll (ms) = 5000, felix.fileinstall.dir = /home/thufir/glassfish-3.0.1/glassfish/domains/domain1/autodeploy/bundles, felix.fileinstall.debug = 1, felix.fileinstall.bundles.new.start = true, felix.fileinstall.tmpdir = /tmp/fileinstall-3996754497384347726, felix.fileinstall.filter = null}
INFO: Started bundle: file:/home/thufir/glassfish-3.0.1/glassfish/modules/autostart/osgi-web-container.jar
INFO: Started bundle: file:/home/thufir/glassfish-3.0.1/glassfish/modules/autostart/org.apache.felix.scr.jar
INFO: SEC1002: Security Manager is OFF.
INFO: Security startup service called
INFO: SEC1143: Loading policy provider com.sun.enterprise.security.provider.PolicyWrapper.
INFO: Realm admin-realm of classtype com.sun.enterprise.security.auth.realm.file.FileRealm successfully created.
INFO: Realm file of classtype com.sun.enterprise.security.auth.realm.file.FileRealm successfully created.
INFO: Realm certificate of classtype com.sun.enterprise.security.auth.realm.certificate.CertificateRealm successfully created.
INFO: Security service(s) started successfully....
INFO: Total number of available updates : 59
INFO: Available updates :
glassfish-full-incorporation 3.1,0-43:20110215T074016Z Tue Feb 15 07:40:16 PST 2011
glassfish-web-incorporation 3.1,0-43:20110215T074014Z Tue Feb 15 07:40:14 PST 2011
glassfish-web-l10n 3.1,0-41.1:20110213T154415Z Sun Feb 13 15:44:15 PST 2011
glassfish-ejb-lite-l10n 3.1,0-41.1:20110213T154350Z Sun Feb 13 15:43:50 PST 2011
pkg-java 1.122,0-52.2817:20110218T204119Z Fri Feb 18 20:41:19 PST 2011
glassfish-ejb-l10n 3.1,0-41.1:20110213T154345Z Sun Feb 13 15:43:45 PST 2011
glassfish-gui-l10n 3.1,0-41.1:20110213T154326Z Sun Feb 13 15:43:26 PST 2011
glassfish-nucleus-l10n 3.1,0-41.1:20110213T154338Z Sun Feb 13 15:43:38 PST 2011
javadb-core 10.6.2.1,0-1:20101213T185842Z Mon Dec 13 18:58:42 PST 2010
javadb-client 10.6.2.1,0-1:20101213T185835Z Mon Dec 13 18:58:35 PST 2010
jersey 1.5,0-1.0:20110215T072802Z Tue Feb 15 07:28:02 PST 2011
mq-core 4.5,0-29.2:20110210T074434Z Thu Feb 10 07:44:34 PST 2011
glassfish-jdbc-l10n 3.1,0-41.1:20110213T154422Z Sun Feb 13 15:44:22 PST 2011
glassfish-full-profile 3.1,0-43:20110215T074029Z Tue Feb 15 07:40:29 PST 2011
glassfish-upgrade-l10n 3.1,0-41.1:20110213T154456Z Sun Feb 13 15:44:56 PST 2011
glassfish-jca-l10n 3.1,0-41.1:20110213T154405Z Sun Feb 13 15:44:05 PST 2011
javadb-common 10.6.2.1,0-1:20101213T185828Z Mon Dec 13 18:58:28 PST 2010
glassfish-common-full-l10n 3.1,0-41.1:20110213T154354Z Sun Feb 13 15:43:54 PST 2011
glassfish-web-profile 3.1,0-43:20110215T074022Z Tue Feb 15 07:40:22 PST 2011
glassfish-common-l10n 3.1,0-41.1:20110213T154451Z Sun Feb 13 15:44:51 PST 2011
glassfish-jts-l10n 3.1,0-41.1:20110213T154359Z Sun Feb 13 15:43:59 PST 2011
glassfish-jms-l10n 3.1,0-41.1:20110213T154409Z Sun Feb 13 15:44:09 PST 2011
glassfish-corba 3.1.0,0-27:20110215T071130Z Tue Feb 15 07:11:30 PST 2011
glassfish-jms 3.1,0-43:20110215T072339Z Tue Feb 15 07:23:39 PST 2011
mq-locale 4.5,0-29.2:20110210T074528Z Thu Feb 10 07:45:28 PST 2011
mq-server 4.5,0-29.2:20110210T074445Z Thu Feb 10 07:44:45 PST 2011
mq-bin-sh 4.5,0-29.2:20110210T074442Z Thu Feb 10 07:44:42 PST 2011
metro 2.1,0-30:20110215T073257Z Tue Feb 15 07:32:57 PST 2011
glassfish-cmp 3.1,0-43:20110215T072715Z Tue Feb 15 07:27:15 PST 2011
mq-bin-exe 4.5,0-29.2:20110210T105419Z Thu Feb 10 10:54:19 PST 2011
glassfish-ejb 3.1,0-43:20110215T072446Z Tue Feb 15 07:24:46 PST 2011
glassfish-common-full 3.1,0-43:20110215T072130Z Tue Feb 15 07:21:30 PST 2011
glassfish-appclient 3.1,0-43:20110215T073837Z Tue Feb 15 07:38:37 PST 2011
mq-config-gf 4.5,0-29.2:20110210T074525Z Thu Feb 10 07:45:25 PST 2011
glassfish-grizzly-full 1.9.31,0-1:20110215T070725Z Tue Feb 15 07:07:25 PST 2011
glassfish-management 3.1,0-43:20110215T071037Z Tue Feb 15 07:10:37 PST 2011
glassfish-hk2 3.1,0-43:20110215T070538Z Tue Feb 15 07:05:38 PST 2011
glassfish-upgrade 3.1,0-43:20110215T071009Z Tue Feb 15 07:10:09 PST 2011
glassfish-jts 3.1,0-43:20110215T072233Z Tue Feb 15 07:22:33 PST 2011
glassfish-corba-base 3.1.0,0-27:20110215T070738Z Tue Feb 15 07:07:38 PST 2011
glassfish-javahelp 2.0.2,0-1:20110215T071001Z Tue Feb 15 07:10:01 PST 2011
glassfish-scripting 3.1,0-41:20110208T202810Z Tue Feb 08 20:28:10 PST 2011
glassfish-nucleus 3.1,0-43:20110215T070659Z Tue Feb 15 07:06:59 PST 2011
glassfish-jpa 3.1,0-43:20110215T071106Z Tue Feb 15 07:11:06 PST 2011
glassfish-ejb-lite 3.1,0-43:20110215T072030Z Tue Feb 15 07:20:30 PST 2011
glassfish-jcdi 3.1,0-43:20110215T072735Z Tue Feb 15 07:27:35 PST 2011
glassfish-jdbc 3.1,0-43:20110215T071818Z Tue Feb 15 07:18:18 PST 2011
glassfish-common 3.1,0-43:20110215T074007Z Tue Feb 15 07:40:07 PST 2011
glassfish-jsf 2.1.0,0-11:20110215T071155Z Tue Feb 15 07:11:55 PST 2011
glassfish-gui 3.1,0-43:20110215T071924Z Tue Feb 15 07:19:24 PST 2011
glassfish-registration 3.1,0-43:20110215T071019Z Tue Feb 15 07:10:19 PST 2011
felix 3.0.8,0-0:20110215T070355Z Tue Feb 15 07:03:55 PST 2011
glassfish-grizzly 1.9.31,0-1:20110215T070555Z Tue Feb 15 07:05:55 PST 2011
glassfish-web 3.1,0-43:20110215T071324Z Tue Feb 15 07:13:24 PST 2011
glassfish-jta 3.1,0-43:20110215T071139Z Tue Feb 15 07:11:39 PST 2011
glassfish-jca 3.1,0-43:20110215T071053Z Tue Feb 15 07:10:53 PST 2011
glassfish-cluster 3.1,0-43:20110215T070945Z Tue Feb 15 07:09:45 PST 2011
shoal 1.5.29,0-0:20110215T070911Z Tue Feb 15 07:09:11 PST 2011
glassfish-ha 3.1,0-43:20110215T070954Z Tue Feb 15 07:09:54 PST 2011
INFO: Created HTTP listener http-listener-1 on port 8081
INFO: Created HTTP listener http-listener-2 on port 8181
INFO: Created HTTP listener admin-listener on port 4848
INFO: Created virtual server server
INFO: Created virtual server __asadmin
INFO: Virtual server server loaded system default web module
INFO: Initializing Mojarra 2.0.2 (FCS b10) for context '/WebApplication1'
INFO: Loading application WebApplication1 at /WebApplication1
INFO: WebApplication1 was successfully deployed in 245,397 milliseconds.
Java DB Database Process:
2011-03-03 04:49:35.249 GMT : Security manager installed using the Basic server security policy.
2011-03-03 04:49:48.584 GMT : Could not listen on port 1527 on host localhost:
java.net.BindException: Address already in use
WebApplication1 (run):
init:
deps-module-jar:
deps-ear-jar:
deps-jar:
library-inclusion-in-archive:
library-inclusion-in-manifest:
compile:
compile-jsps:
Starting GlassFish Server 3
GlassFish Server 3 is running.
In-place deployment at /home/thufir/NetBeansProjects/WebApplication1/build/web
Initializing...
run-deploy:
Browsing: http://localhost:8080/WebApplication1/
run-display-browser:
run:
BUILD SUCCESSFUL (total time: 15 minutes 35 seconds)
However, that "database" still on the wrong port for some reason(?).
I modified one domain.xml, but there's also one in template:
thufir#tleilax:~$
thufir#tleilax:~$ nl /home/thufir/glassfish-3.0.1/glassfish/domains/domain1/config/domain.xml | grep 8081
189 <network-listener port="8081" protocol="http-listener-1" transport="tcp" name="http-listener-1" thread-pool="http-thread-pool" />
thufir#tleilax:~$
thufir#tleilax:~$
thufir#tleilax:~$ ll /home/thufir/glassfish-3.0.1/glassfish/lib/templates/domain.xml
-rw-rw-r-- 1 thufir thufir 12804 2010-06-08 15:37 /home/thufir/glassfish-3.0.1/glassfish/lib/templates/domain.xml
thufir#tleilax:~$
However, glassfish now seems to be running ok, although I would prefer it on 8080 as it would be by default. I just don't understand why there's a database connection to, apparently, no database -- certainly not one I selected.
thufir#tleilax:~$
thufir#tleilax:~$ sudo lsof -i :1527
[sudo] password for thufir:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 4757 thufir 27u IPv6 46934 0t0 TCP localhost.localdomain:1527 (LISTEN)
thufir#tleilax:~$
thufir#tleilax:~$
thufir#tleilax:~$
thufir#tleilax:~$ nl /home/thufir/glassfish-3.0.1/glassfish/domains/domain1/config/domain.xml | grep 8081
189 <network-listener port="8081" protocol="http-listener-1" transport="tcp" name="http-listener-1" thread-pool="http-thread-pool" />
thufir#tleilax:~$
thufir#tleilax:~$ ll /home/thufir/glassfish-3.0.1/glassfish/lib/templates/domain.xml
-rw-rw-r-- 1 thufir thufir 12804 2010-06-08 15:37 /home/thufir/glassfish-3.0.1/glassfish/lib/templates/domain.xml
thufir#tleilax:~$
thufir#tleilax:~$ sudo lsof -i :1527
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 4757 thufir 27u IPv6 46934 0t0 TCP localhost.localdomain:1527 (LISTEN)
thufir#tleilax:~$
thufir#tleilax:~$
It means the port 8080 has already been used by other process in your system.
try to run sudo lsof -i :8080 to see what process/service runs on that port and terminate it.
Another solution is to completely change the port number.
I had this kind of problem last time when installing Netbeans for second time a year ago but as far as I remember I had v2 glassfish and v3 beta (2 years ago).
What I did is to change the port number. Have a look at domain.xml (probably) and change the port number 8080 to something else (unoccupied port).

Resources