Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FRR Init script #354

Closed
ne-vlezay80 opened this issue Apr 9, 2017 · 3 comments
Closed

FRR Init script #354

ne-vlezay80 opened this issue Apr 9, 2017 · 3 comments
Assignees

Comments

@ne-vlezay80
Copy link
Contributor

ne-vlezay80 commented Apr 9, 2017

#!/bin/bash

### BEGIN INIT INFO
# Provides:             frr
# Required-Start:       $remote_fs $syslog
# Required-Stop:        $remote_fs $syslog
# Default-Start:        2 3 4 5
# Default-Stop:         
# Short-Description:    FreeRouting Project
### END INIT INFO


FRR_PATH="/opt/frr"
DAEMONS="zebra bgpd"
PARAMS="-A 0.0.0.0 -d"

ACTION=$1
SHELL_CMD=$(echo $@|cut -d ' ' -f 2-|tr ' ' '_')

case $SHELL_CMD in
	shell)
		unset SHELL_CMD
		;;
	* )
		true
		;;
esac

echo $SHELL_CMD

start(){
	PATH=$PATH:$FRR_PATH/bin:$FRR_PATH/sbin
	for a in $(echo $DAEMONS)
	do
		printf "Starting $a..."
		if $a $PARAMS
		then
			printf "OK\n"
		else
			printf "FAILED\n"
		fi
	done
}

stop(){
	PATH=$PATH:$FRR_PATH/bin:$FRR_PATH:/sbin
	for a in $(echo $DAEMONS)
	 do
		printf "Starting $a..."
		if killall $a
		then
				printf "OK\n"
		else
				printf "FAILED\n" 
		fi
	done
}

case $ACTION in
	start)
		start
		;;
	stop)
		stop
		;;
	shell)
		PATH=$PATH:$FRR_PATH/bin:$FRR_PATH/sbin
		if test $SHELL_CMD
		then
			if vtysh -c "$(echo $SHELL_CMD|tr '_' ' ')"
			then
				exit 0
			else
				echo "E: Failed connect on vtysh"
				exit 1
			fi
		else
			true
		fi
		
		if vtysh
		then
			exit 0
		else
			echo "E: Failed to connect on vtysh"
			exit 1
		fi
		;;
	* )
		echo "Usage: start|stop|shell"
		;;
esac
@mwinter-osr mwinter-osr self-assigned this Apr 11, 2017
@mwinter-osr
Copy link
Member

Current (old) redhat scripts have a init script per daemon.
In the process to change this, but the correct way would be to select daemons based on a daemons.conf file (similar like on debian).
A newer init script already exists as tools/frr, but it needs fixes for rpm based systems

I'm working on fixing this and various other rpm packaging issues. Current progress can be seen at https://github.com/opensourcerouting/frr/tree/rpm-fixes-2.0

@mwinter-osr
Copy link
Member

Pull Request with updated init script for stable/2.0 is submitted. See #378
Would appreciate if you could test and provide feedback on it.

@mwinter-osr
Copy link
Member

Closing - old issue and fixed some time ago for RPMs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants