human
linux copy pid of script to a file at time of init.
assistant
Here is a Python function to copy a script to a file at the time of init

import os

def copy_pid_to_file(pid, file_name):
    """Copy pid of script to a file at time of init.

    :param int pid:
    :param str file_name:
    :rtype: None
    :return:
    """
    with open(file_name, 'w') as f:
        f.write(str(pid))

# Enter the pid
pid = 12345

# Enter the file name
file_name = "/home/rosey/test.pid"

# Calling the function
print((copy_pid_to_file(pid, file_name)))

#Example Output
# None

#Remember to inspect code for bugs.