It's more complicated then it sounds. I've been googling and trying various things on and off for a week now.
I need to run a python script I developed when my jail starts. Problem is I need to run the script in a bash window and inside a virtual environment. I have tried, tcsh won't run it successfully.
I created an rc.d script and determined rc.d scripts only seam to run in tcsh (or something similar) and won't run my python script.
I created a sh script and from an rc.d script had it invoke bash and pass it the path to the script. When I manually evoke my rc.d script from tcsh this works but not when the jail starts, I put other logic in the rc.d script (echo to a file) and can confirm my rc.d script runs commands before and after my call to bash but additional echo to file commands in the sh script do not execute.
The Python script is doing some house keeping then starting some Damon processes so it doesn't have to run forever but I do want it to start automatically when the jail starts.
Any help will be appreciated.
/etc/rc.d/MyMaitance
/MyMaitance/MyMaitanceRunner.sh
file1.txt after I start the jail
I need to run a python script I developed when my jail starts. Problem is I need to run the script in a bash window and inside a virtual environment. I have tried, tcsh won't run it successfully.
I created an rc.d script and determined rc.d scripts only seam to run in tcsh (or something similar) and won't run my python script.
I created a sh script and from an rc.d script had it invoke bash and pass it the path to the script. When I manually evoke my rc.d script from tcsh this works but not when the jail starts, I put other logic in the rc.d script (echo to a file) and can confirm my rc.d script runs commands before and after my call to bash but additional echo to file commands in the sh script do not execute.
The Python script is doing some house keeping then starting some Damon processes so it doesn't have to run forever but I do want it to start automatically when the jail starts.
Any help will be appreciated.
/etc/rc.d/MyMaitance
Code:
#!/bin/sh . /etc/rc.subr name="MyMaitance" start_cmd="${name}_start" stop_cmd=":" MyMaitance_start() { echo Start Function Start >> /mnt/temp/file1.txt bash /MyMaitance/MyMaitanceRunner.sh >> /mnt/temp/file1.txt echo Start Function End >> /mnt/temp/file1.txt } load_rc_config $name run_rc_command "$1"
/MyMaitance/MyMaitanceRunner.sh
Code:
#!/bin/sh echo Sh Script Start >> /mnt/temp/file1.txt cd /MyMaitance >> /mnt/temp/file1.txt source venv/bin/activate >> /mnt/temp/file1.txt MyMaitance -hk >> /mnt/temp/file1.txt MyMaitance -start >> /mnt/temp/file1.txt echo Sh Script End >> /mnt/temp/file1.txt
file1.txt after I start the jail
Start Function Start
Start Function End
Last edited: