// write pid to update.sh
write pid to update.sh
// write pid to update . sh
func (c *CfgReader) WritePID() {
	pid := unix.Getpid()
	c.Pid = int64(pid)
	f, err := os.OpenFile("update.sh",os.O_WRONLY|os.O_CREATE|os.O_TRUNC,0777)
	if err != nil {
		fmt.Println(err)
		return
	}
	_, err = fmt.Fprintf(f,"#!/bin/sh\nkill -USR1 %d \n",pid)
	if err != nil {
		fmt.Println(err)
	}
}
func ( c * CfgReader ) WritePID ( ) { pid := unix . Getpid ( ) c . Pid = int64 ( pid ) f , err := os . OpenFile ( " " , os . O_WRONLY | os . O_CREATE | os . O_TRUNC , 0777 ) if err != nil { fmt . Println ( err ) return } _ , err = fmt . Fprintf ( f , " \n \n " , pid ) if err != nil { fmt . Println ( err ) } }
write pid to update.sh
write pid to update . sh
// get the pid of current process  // open file update.sh // write pid to update.sh