#!/bin/bash

##script to shutdown lightdm if runlevel = 6 or 0

current_run_level=$(runlevel |cut -d' ' -f2)
touch /etc/current_run_level
sysVinit_check=$(ps -aux |grep init |grep -v grep)
if [ -n "$sysVinit_check" ]; then
	if [ "$current_run_level" = "6" -o "$current_run_level" = "0" ]; then
		echo "$current_run_level">/etc/current_run_level
		chvt 7
		service lightdm stop &

exit 0
	fi
fi
exit 0
