116 | | '''Platform Configuration File''': This file has one mandatory section, ''[cpu_info]'', and N optional sections, ''[daemon]''. The second selects which daemons (and their path) will be launched by runph. You can add or remove them according to which daemons you need in your platform (see PhalManual). The CPU configuration section, has two fields: |
| 118 | '''Platform Configuration File''': This file has one mandatory section, ''[cpu_info]'', and N optional sections, ''[daemon]''. The second selects which daemons (and their path) will be launched by runph. You can add or remove them according to which daemons you need in your platform (see PhalManual). This sections have two fields only: |
| 119 | * ''path'': Path where the executable is. |
| 120 | * ''output'': File to redirect standard output (for loggin purposes) |
| 121 | |
| 122 | In the CPU section, you can specify some default P-HAL configuration parameters. '''Note''': This parameters are overriden by the ones passed as arguments to the P-HAL Launcher. See section above for more details. |
| 146 | == Launching P-HAL as a Daemon == |
| 147 | |
| 148 | Running P-HAL in background is often interesing when long time executions are going to be performed. In foreground executions, disconnecting user terminal (or ssh session) will kill P-HAL processes as they inherit from user session. This can be prevented to happen if the user launches P-HAL with the ''daemon'' option (as an argument or in the platform configuration file, see above) and appropiate selects an output for text messages. |
| 149 | |
| 150 | When running in this mode, '''CMDMANAGER''' daemon must be also launched as daemon. It can't read commands from standard input anymore and a tcp socket should be created. Thus, another CMDMANAGER process (local or remote) can connect to it and send normal P-HAL commands (as if it was local). |
| 151 | |
| 152 | To do so, make sure you follow these steps: |
| 153 | 1. Modify Platform configuration file, adding the field '''run_as_daemon'''=''yes'' to the CPU section or launch P-HAL with the '''--daemon''' argument. |
| 154 | 2. Modify Platform configuration file, adding the field '''output_file'''=''hwapi_log_file'' to the CPU section or launch P-HAL with the '''-o''' ''hwapi_log_file'' argument. |
| 155 | 3. Modify Platform configuration file, changing the arguments of the '''cmdman''' enabling it to listen to input connections ('''-l''') and run as daemon ('''-d'''). At this step, your configuration file should show something like the following: |
| 156 | {{{ |
| 157 | [cpu_info] |
| 158 | mips=... |
| 159 | tslot=... |
| 160 | ... |
| 161 | run_as_daemon=yes |
| 162 | output_file=/path/to/mylog/hwapi_output.log |
| 163 | work_path=/path/to/phal-repositories/ |
| 164 | ... |
| 165 | [daemon] |
| 166 | ... |
| 167 | [daemon] |
| 168 | path=cmdman -l -p |
| 169 | }}} |
| 170 | 4.Then, if you specified '''work_path''' field in your configuration file, you can launch P-HAL just by typing: |
| 171 | {{{ |
| 172 | runph |
| 173 | }}} |
| 174 | from any directory. This would launch P-HAL and send it to background. |
| 175 | 5. Now to perform commands you must connect to it (from local or remote machine): |
| 176 | {{{ |
| 177 | cmdman -c 192.168.1.1 |
| 178 | }}} |
| 179 | where 192.168.1.1 should obviously be replaced by the IP address where you launched the daemon. In this screen, you can type commands as usual and exit typing Ctrl+C. You will notice as you can re-connect with the same command and perform more commands. |
| 180 | At this point, you can exit your ssh session normally. P-HAL will keep running at background. When you login again, connect again with the previous cmdman command. Also, keep track of the output files (specifiyed at the configuration file) for errors or unusual behaviour. |
| 181 | 6. Finally, you can kill PHAL by sending a INT signal. This can be done typing: |
| 182 | {{{ |
| 183 | killall -s INT runph |
| 184 | }}} |
| 185 | |
| 186 | |
| 187 | [[BR]] |
| 188 | |