Hi, Everyone if any one can help me guide me to move sh script to python.
thanks.

#!/bin/bash

DATE=$(date +"%m_%d_%Y");

turn_off_services()
{
  echo -e "\n## Remove unnecessary services" 

  ## Turn off unnecessary services
  ## chkconfig --list |egrep -i "iptables|smartd|kudzu|bluetooth|rpcgssd"

  chkconfig iptables off
  chkconfig smartd off
  chkconfig kudzu off
  chkconfig bluetooth off
  chkconfig rpcgssd off

  chkconfig --list |egrep -i "iptables|smartd|kudzu|bluetooth|rpcgssd"
  echo "done."
} 

You only do a loop calling the chkconfig command, better not to reimplement it in Python.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.