Comments (6)
The program should run in the background just fine.
Can you post the service file you used? I am interested especially in the ExecStart line.
from virtual-ip.
Hi, Sure
[root@columba bin]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:21:f6:69:46:a5 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.18/24 brd 192.168.0.255 scope global noprefixroute eth0
valid_lft forever preferred_lft forever
inet 192.168.0.185/32 brd 192.168.0.185 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::1213:e177:3d69:310b/64 scope link noprefixroute
valid_lft forever preferred_lft forever
3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether 52:54:00:65:c4:3b brd ff:ff:ff:ff:ff:ff
inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
valid_lft forever preferred_lft forever
4: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN group default qlen 1000
link/ether 52:54:00:65:c4:3b brd ff:ff:ff:ff:ff:ff
[root@columba ~]# vim /etc/systemd/system/virtual-ip.service
[Unit]
Description= Virtual/Floating IP Manager
[Service]
Type=forking
ExecStart=/root/bin/virtual-ip -id server1 -bind 192.168.0.18:10000 -peers server1=192.168.0.18:10000,server2=192.168.0.45:10000 -interface eth0 -virtual-ip 192.168.0.185 &
ExecStop=killall virtual-ip
PIDFile=/root/bin/virtual-ip.pid
[Install]
WantedBy=network.target
[root@columba bin]# systemctl daemon-reload
[root@columba bin]# systemctl status virtual-ip
● virtual-ip.service - Virtual/Floating IP Manager
Loaded: loaded (/etc/systemd/system/virtual-ip.service; disabled; vendor preset: disabled)
Active: failed (Result: timeout) since Thu 2019-06-06 15:59:35 CDT; 5min ago
Jun 06 15:58:05 columba.multisolutions.local systemd[1]: Starting Virtual/Floating IP Manager...
Jun 06 15:58:05 columba.multisolutions.local virtual-ip[13171]: time="2019-06-06T15:58:05-05:00" level=info msg=Virtual-IP version=0.1.4
Jun 06 15:58:05 columba.multisolutions.local virtual-ip[13171]: time="2019-06-06T15:58:05-05:00" level=info msg=Cluster bind="192.168.0.18:10000" id=server1 peers="server1=192.168.0.18:10000...0.45:10000"
Jun 06 15:58:05 columba.multisolutions.local virtual-ip[13171]: time="2019-06-06T15:58:05-05:00" level=info msg=Network interface=eth0 virtual-ip=192.168.0.185
Jun 06 15:58:05 columba.multisolutions.local virtual-ip[13171]: time="2019-06-06T15:58:05-05:00" level=info msg=Started
Jun 06 15:59:35 columba.multisolutions.local systemd[1]: virtual-ip.service start operation timed out. Terminating.
Jun 06 15:59:35 columba.multisolutions.local systemd[1]: Failed to start Virtual/Floating IP Manager.
Jun 06 15:59:35 columba.multisolutions.local systemd[1]: Unit virtual-ip.service entered failed state.
Jun 06 15:59:35 columba.multisolutions.local systemd[1]: virtual-ip.service failed.
Warning: virtual-ip.service changed on disk. Run 'systemctl daemon-reload' to reload units.
Hint: Some lines were ellipsized, use -l to show in full.
[root@columba bin]# systemctl daemon-reload
[root@columba bin]# systemctl start virtual-ip
Hangs
from virtual-ip.
You need to remove the & at the end of the command in ExecStart and perhaps the Type line.
from virtual-ip.
Good!, Yes removing Type and & works, now I changed to this and woks all fine. Thanks for solution and develop this tool.
[Unit]
Description= Virtual/Floating IP Manager
Requires=network-online.target
[Service]
Type=simple
ExecStart=/root/bin/virtual-ip -id server1 -bind 192.168.0.18:10000 -peers server1=192.168.0.18:10000,server2=192.168.0.45:10000 -interface eth0 -virtual-ip 192.168.0.185
ExecStop=/usr/bin/killall virtual-ip
PIDFile=/root/bin/virtual-ip.pid
from virtual-ip.
This is the result:
[root@columba ~]# systemctl status virtual-ip -l
● virtual-ip.service - Virtual/Floating IP Manager
Loaded: loaded (/etc/systemd/system/virtual-ip.service; static; vendor preset: disabled)
Active: active (running) since Mon 2019-06-10 11:39:06 CDT; 9min ago
Main PID: 17309 (virtual-ip)
Tasks: 10
CGroup: /system.slice/virtual-ip.service
└─17309 /root/bin/virtual-ip -id server1 -bind 192.168.0.18:10000 -peers server1=192.168.0.18:10000,server2=192.168.0.45:10000 -interface eth0 -virtual-ip 192.168.0.185
Jun 10 11:39:06 columba.multisolutions.local systemd[1]: Started Virtual/Floating IP Manager.
Jun 10 11:39:06 columba.multisolutions.local virtual-ip[17309]: time="2019-06-10T11:39:06-05:00" level=info msg=Virtual-IP version=0.1.4
Jun 10 11:39:06 columba.multisolutions.local virtual-ip[17309]: time="2019-06-10T11:39:06-05:00" level=info msg=Cluster bind="192.168.0.18:10000" id=server1 peers="server1=192.168.0.18:10000,server2=192.168.0.45:10000"
Jun 10 11:39:06 columba.multisolutions.local virtual-ip[17309]: time="2019-06-10T11:39:06-05:00" level=info msg=Network interface=eth0 virtual-ip=192.168.0.185
Jun 10 11:39:06 columba.multisolutions.local virtual-ip[17309]: time="2019-06-10T11:39:06-05:00" level=info msg=Started
[root@columba ~]# ping -c 3 192.168.0.185
PING 192.168.0.185 (192.168.0.185) 56(84) bytes of data.
64 bytes from 192.168.0.185: icmp_seq=1 ttl=64 time=0.136 ms
64 bytes from 192.168.0.185: icmp_seq=2 ttl=64 time=0.138 ms
64 bytes from 192.168.0.185: icmp_seq=3 ttl=64 time=0.162 ms
--- 192.168.0.185 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2061ms
rtt min/avg/max/mdev = 0.136/0.145/0.162/0.015 ms
from virtual-ip.
Very nice. I am glad it worked out for you. Feel free to update the README if you want systemd integration documented.
from virtual-ip.
Related Issues (1)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from virtual-ip.