#!/bin/sh . /etc/rc.common # __START_CONFIG__ binary_app=/usr/bin/true config_file=/etc/inetd.conf MOD_NAME="ABC" # __END_CONFIG__ # this file does nothing. ####
binary_app:
config_file:
MOD_NAME:
#### #!/usr/bin/perl # Open File - Read File Contents Then Modify & save contents # Specify name of file $data_file="sample.pm"; # Name of temp file 1 $prefile1="/tmp/123456.beg"; # Name of temp file 2 $prefile2="/tmp/123456.end"; $action = 1; # Open File abd read it all in to rawdata open (file_beg, ">$prefile1") || die ("Could not open file.
$!");# Open The File open (file_end, ">$prefile2") || die ("Could not open file.
$!");# Open The File open (sample, "$data_file") || die ("Could not open file.
$!");# Open The File flock(sample, 2) or die "cannot lock file exclusively: $!";# Lock The File @rawdata = ;# Put data from file into array called sample # write data from sample.pm into beg_non_edit foreach $value (@rawdata) { print ("$value\n"); if($value =~ /# __END_CONFIG__/i) { $action=3; } if ( $action == 1 ) { # write to file_beg print file_beg "$value"; # as long as action is 1 it should write to this file. } if ($action == 3) { # write to file_end print file_end "$value"; # as long as action is 3 it will write to this file } if ($action == 2) { ; # copy string to new array } if($value =~ /# __START_CONFIG__/i) { $action=2; } push @allow_edit, $_; } foreach $value (@allow_edit) { print ("$value\n"); } close (sample); close (file_beg); close (file_end);