How to kill process (created by run-process) - common-lisp

I want to kill a process started by (sb-ext:run-program).
(let ((process (sb-ext:run-program "/path/to/process.sh" '() :wait nil)))
(sleep 10)
(sb-ext:process-close process)
(sb-ext:process-kill process 9 :pid))
According to SBCL-Manual (sb-ext:process-kill process 9 :pid) should send SIGKILL (which has value 9) to process, therefore annihilating this process.
But when I am trying to use this using a dummy process:
#!/bin/bash
i=0
while [ $i -lt 4 ]
do
sleep 5
i+=1
done
It leaves a corps behind which cannot even be killed using htop + kill.
The process tree before execution looked like this:
|- /usr/bin/emacs
| |- /usr/local/bin/sbcl
| | |- /usr/local/bin/sbcl
| | |- /usr/local/bin/sbcl
| | |- /usr/local/bin/sbcl
| | |- /usr/local/bin/sbcl
| | |- /usr/local/bin/sbcl
During execution:
|- /usr/bin/emacs
| |- /usr/local/bin/sbcl
| | |- /bin/bash /path/to/process.sh
| | | |- sleep 5
| | |- /usr/local/bin/sbcl
| | |- /usr/local/bin/sbcl
| | |- /usr/local/bin/sbcl
| | |- /usr/local/bin/sbcl
| | |- /usr/local/bin/sbcl
After execution (the process.sh will not terminate unless the main sbcl is killed/stopped):
|- /usr/bin/emacs
| |- /usr/local/bin/sbcl
| | |- process.sh
| | |- /usr/local/bin/sbcl
| | |- /usr/local/bin/sbcl
| | |- /usr/local/bin/sbcl
| | |- /usr/local/bin/sbcl
| | |- /usr/local/bin/sbcl
The script can be killed and terminated just fine when started manually and using either Ctr-C or htop + kill.
Therefore how can I achive a seamless/corpsless kill within sbcl?
The same happens when using:
(let ((process (sb-ext:run-program "/usr/local/bin/sbcl" '("--dynamic-space-size" "512" "--eval" "(sleep 100)") :wait nil)))
(sleep 10)
(sb-ext:process-close process)
(sb-ext:process-kill process 9 :pid))

The solution looks either like this (if you use streams associated with the process you need process-close):
(let ((process (sb-ext:run-program "/home/user/processTest.sh" '() :wait nil)))
(sleep 10)
(sb-ext:process-kill process 15 :pid)
(sb-ext:process-wait process)
(sb-ext:process-close process)
(sb-ext:process-exit-code process))
Or as Sylvester pointed out you can just leave out the process-close (if you do not have any streams associated with the process):
(let ((process (sb-ext:run-program "/home/user/processTest.sh" '() :wait nil)))
(sleep 10)
(sb-ext:process-kill process 15 :pid))
process-close affects the process in a way that it will become a zombie.
This occurs for child processes, where the entry is still needed to allow the parent process to read its child's exit status.
As soon as the exit status is read via process-exit-code the process is reaped and will disappear.

If you're using the portable uiop:run-program instead of the sbcl's one, you can kill the PID by calling run-program a second time, giving it the kill command, just like you would in the shell:
(uiop:run-program (format nil "kill ~a" (process-info-pid process)))
Where process is the return result of the initial run-program, the one that started the process you want to kill.

Related

How to run shell commands from the Julia REPL?

In the Julia REPL, I would like to run some terminal commands but don't necessarily want to do those commands via a pipe or other syntax which wraps around a system call. Is there a more native way of running terminal commands from the REPL?
Julia's REPL has what is referred to as a Shell mode. You can access the Shell mode via typing in a ; into the terminal which will result in:
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.6.0 (2021-03-24)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
shell>
you can then run commands like:
shell> pwd
/Users/my_username
shell>
Read more about the Shell mode here: https://docs.julialang.org/en/v1/stdlib/REPL/#man-shell-mode

I'm unable to install IJulia

ijulia installation is stuck at 100%
I'm beginner need help.:
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.4.1 (2020-04-14)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
julia> using Pkg
julia> Pkg.add("IJulia")
Cloning default registries into `c:\Users\xxxx\.julia`
Cloning registry from "https://github.com/JuliaRegistries/General.git"
Fetching: [========================================>] 100.0 %
It takes some time to install packages for the first time (e.g. 4mins machine with good internet) - you need just wait.
Sometimes this also might happen when you loose internet connection during the install or it is unstable. In that case you can just press Ctrl+C and try again. After pressing Ctrl+C on rare occasions something might be partially installed - in that case you might end up removing the c:\Users\xxxx\.julia folder. Good luck!

I m installing OROCRM so i have an error during the installation process

I m installing orocrm so i have an error during the installation process
this is my command php app/console oro:install error is [Symfony\Component\Process\Exception\RuntimeException]
The process timed-out.
i have check the oro_install.log file there is no any error
here is the instrucktion page i have followed http://www.orocrm.com/documentation/index/current/book/installation
thanks
this is my console
root#efttt-Intron-5t59:/home/eures/tance/crm-application/orocrm# php app/console oro:install
Installing Oro Application.
Oro requirements check:
+---------+------------------------------------------------------------------------------------------+ | Check | Mandatory requirements
|
+---------+------------------------------------------------------------------------------------------+ | OK | Vendor libraries must be installed
| | OK | app/cache/ directory must be writable
| | OK | app/logs/ directory must be writable
| | OK | Configured default timezone "Asia/Colombo" must be
supported by your installation of PHP | | OK | json_encode() must
be available
| | OK | session_start() must be available
| | OK | ctype_alpha() must be available
| | OK | token_get_all() must be available
| | OK | simplexml_import_dom() must be available
| | OK | PCRE extension must be available
| | OK | Cache folder should not be inside encrypted directory
|
+---------+------------------------------------------------------------------------------------------+
+---------+--------------------------------------------+ | Check | PHP settings |
+---------+--------------------------------------------+ | OK | date.timezone setting must be set | | OK |
detect_unicode must be disabled in php.ini | | OK | memory_limit
should be at least 512M |
+---------+--------------------------------------------+
+---------+------------------------------------------------------------------+ | Check | Oro specific requirements
|
+---------+------------------------------------------------------------------+ | OK | PHP version must be at least 5.4.9 (5.6.11-1ubuntu3.1
installed) | | OK | GD extension must be at least 2.0
| | OK | cURL extension must be at least 7.0
| | OK | mcrypt_encrypt() should be available
| | OK | intl extension should be available
| | OK | icu library must be at least 3.8
| | OK | web/uploads/ directory must be writable
| | OK | web/media/ directory must be writable
| | OK | web/bundles/ directory must be writable
| | OK | app/attachment/ directory must be writable
| | OK | web/js directory must be writable
| | OK | web/css directory must be writable
| | OK | app/config/parameters.yml file must be writable
|
+---------+------------------------------------------------------------------+
+---------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Check | Optional recommendations
|
+---------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | OK | Requirements file should be up-to-date
| | OK | When using the logout handler from the Symfony Security
Component, you should have at least PHP 5.4.11 due to PHP bug #63379
(as a workaround, you can also set invalidate_session to false in the
security logout handler configuration) | | OK | PCRE extension
should be at least version 8.0 (8.35 installed)
| | OK | PHP-XML module should be installed
| | OK | mb_strlen() should be available
| | OK | iconv() should be available
| | OK | utf8_decode() should be available
| | OK | posix_isatty() should be available
| | OK | intl extension should be available
| | OK | intl extension should be correctly configured
| | OK | intl ICU version should be at least 4+
| | OK | a PHP accelerator should be installed
| | OK | short_open_tag should be disabled in php.ini
| | OK | magic_quotes_gpc should be disabled in php.ini
| | OK | register_globals should be disabled in php.ini
| | OK | session.auto_start should be disabled in php.ini
| | OK | PDO should be installed
| | OK | PDO should have some drivers installed (currently
available: dblib, mysql, odbc)
| | OK | SOAP extension should be installed (API calls)
| | OK | A JS Engine (node) is installed
|
+---------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Dropping database schema... Database schema dropped successfully!
Clear the entity config cache Clear the extended entity cache Setting
up database. Process migrations...
Oro\Bundle\MigrationBundle\Migration\CreateMigrationTableMigration
Oro\Bundle\OrganizationBundle\Migrations\Schema\OroOrganizationBundleInstaller
Oro\Bundle\SecurityBundle\Migrations\Schema\v1_0\OroSecurityBundle
Oro\Bundle\AttachmentBundle\Migrations\Schema\OroAttachmentBundleInstaller
Oro\Bundle\EmailBundle\Migrations\Schema\OroEmailBundleInstaller
Oro\Bundle\UserBundle\Migrations\Schema\OroUserBundleInstaller
Oro\Bundle\SSOBundle\Migrations\Schema\OroUserBundleInstaller
Oro\Bundle\EntityConfigBundle\Migrations\Schema\OroEntityConfigBundleInstaller
Oro\Bundle\EntityConfigBundle\Migrations\Schema\v1_3\OroEntityConfigBundle
Oro\Bundle\EntityConfigBundle\Migrations\Schema\v1_4\FixOptionSetObjects
Oro\Bundle\EntityConfigBundle\Migrations\Schema\v1_5\DropFieldConfig
Oro\Bundle\EntityExtendBundle\Migrations\Schema\OroEntityExtendBundleInstaller
Oro\Bundle\EntityExtendBundle\Migrations\Schema\v1_3\OroEntityExtendBundle
Oro\Bundle\IntegrationBundle\Migrations\Schema\OroIntegrationBundleInstaller
Oro\Bundle\ActivityBundle\Migrations\Schema\OroActivityBundleInstaller
Oro\Bundle\ActivityListBundle\Migrations\Schema\OroActivityListBundleInstaller
Oro\Bundle\AddressBundle\Migrations\Schema\OroAddressBundleInstaller
Oro\Bundle\BatchBundle\Migrations\Schema\OroBatchBundleInstaller
Oro\Bundle\CalendarBundle\Migrations\Schema\OroCalendarBundleInstaller
Oro\Bundle\CalendarBundle\Migrations\Schema\v1_9\OroCalendarBundle
Oro\Bundle\ConfigBundle\Migrations\Schema\OroConfigBundleInstaller
Oro\Bundle\CronBundle\Migrations\Schema\v1_0\OroCronBundle
Oro\Bundle\CronBundle\Migrations\Schema\v1_0\JmsJob
Oro\Bundle\CronBundle\Migrations\Schema\v1_1\JmsJob
Oro\Bundle\DataAuditBundle\Migrations\Schema\OroDataAuditBundleInstaller
Oro\Bundle\DataGridBundle\Migrations\Schema\OroDataGridBundleInstaller
Oro\Bundle\EmbeddedFormBundle\Migrations\Schema\OroEmbeddedFormBundleInstaller
Oro\Bundle\ImapBundle\Migrations\Schema\v1_0\OroImapBundle
Oro\Bundle\ImapBundle\Migrations\Schema\v1_1\OroImapBundle
Oro\Bundle\ImapBundle\Migrations\Schema\v1_2\OroImapBundle
Oro\Bundle\InstallerBundle\Migrations\Schema\OroInstallerBundle
Oro\Bundle\MigrationBundle\Migrations\Schema\v1_0\OroMigrationBundle
Oro\Bundle\MigrationBundle\Migrations\Schema\v1_1\OroMigrationBundle
Oro\Bundle\NoteBundle\Migrations\Schema\v1_0\OroNoteBundle
Oro\Bundle\NoteBundle\Migrations\Schema\v1_1\OroNoteBundle
Oro\Bundle\NotificationBundle\Migrations\Schema\OroNotificationBundleInstaller
Oro\Bundle\ReportBundle\Migrations\Schema\OroReportBundleInstaller
Oro\Bundle\SearchBundle\Migrations\Schema\OroSearchBundleInstaller
Oro\Bundle\SegmentBundle\Migrations\Schema\OroSegmentBundleInstaller
Oro\Bundle\SidebarBundle\Migrations\Schema\v1_0\OroSidebarBundle
Oro\Bundle\SidebarBundle\Migrations\Schema\v1_1\OroSidebarBundle
Oro\Bundle\TagBundle\Migrations\Schema\OroTagBundleInstaller
Oro\Bundle\TranslationBundle\Migrations\Schema\OroTranslationBundleInstaller
Oro\Bundle\WindowsBundle\Migrations\Schema\v1_0\OroWindowsBundle
Oro\Bundle\WorkflowBundle\Migrations\Schema\OroWorkflowBundleInstaller
Oro\Bundle\CommentBundle\Migrations\Schema\v1_0\OroCommentBundle
Oro\Bundle\DashboardBundle\Migrations\Schema\OroDashboardBundleInstaller
Oro\Bundle\NavigationBundle\Migrations\Schema\v1_0\OroNavigationBundle
Oro\Bundle\NavigationBundle\Migrations\Schema\v1_1\OroNavigationBundle
Oro\Bundle\NavigationBundle\Migrations\Schema\v1_2\OroNavigationBundle
Oro\Bundle\NavigationBundle\Migrations\Schema\v1_3\OroNavigationBundle
OroCRM\Bundle\ContactBundle\Migrations\Schema\OroCRMContactBundleInstaller
OroCRM\Bundle\AccountBundle\Migrations\Schema\OroCRMAccountBundleInstaller
-------------------------------------------------------------------- >"Symfony\Component\Process\Exception\RuntimeException The process
timed-out."
probably due to dev log messages, try with the prod symfony env:
php app/console oro:install --env=prod
In the installation instruction on the github project page mention this note also:
Note: If the installation process times out, add the --timeout=0
argument to the command.
Hope this help

Robotframework threads

Is there any way you can start two actions in Robotframework. I'm trying to run a process that will run continuously and then make other actions without stopping the first process. The problem is that RF is waiting the first process to finish, then proceed with other actions. well, problem is the first process is not going to stop. Any advice?
Thanks,
Stell
Yes, you can do this with the Process library. It lets you run programs in the background.
In my open source project rfhub, the acceptance test suite has a suite setup that starts the hub in the background.
Here's the keyword that starts the hub:
*** Keywords ***
| Start rfhub
| | [Arguments] | ${PORT}
| | [Documentation]
| | ... | Starts rfhub on the port given in the variable ${PORT}
| | ... | As a side effect this creates a suite variable named ${rfhub process},
| | ... | which is used by the 'Stop rfhub' keyword.
| |
| | ${rfhub process}= | Start process | python | -m | rfhub | --port | ${PORT}
| | Set suite variable | ${rfhub process}
| | Wait until keyword succeeds | 20 seconds | 1 second
| | ... | Verify URL is reachable | /ping

Partition drive automatically/set OS-DCF:diskConfig to auto with nova

Rackspace Linux cloud servers now set OS-DCF:diskConfig to MANUAL when using nova. This means that the full drive isn't partitioned.
19:29:48 ~$ nova boot server01 --image 62df001e-87ee-407c-b042-6f4e13f5d7e1 --flavor performance2-60 --poll --key-name kylepub
+------------------------+---------------------------------------------+
| Property | Value |
+------------------------+---------------------------------------------+
| status | BUILD |
| updated | 2013-11-16T01:29:58Z |
| OS-EXT-STS:task_state | scheduling |
| key_name | kylepub |
| image | Ubuntu 13.04 (Raring Ringtail) (PVHVM beta) |
| hostId | |
| OS-EXT-STS:vm_state | building |
| flavor | 60 GB Performance |
| id | 9bd6aaac-bbdd-4644-821d-fb697fd48091 |
| user_id | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
| name | server01 |
| adminPass | XXXXXXXXXXXX |
| tenant_id | 864477 |
| created | 2013-11-16T01:29:58Z |
| OS-DCF:diskConfig | MANUAL |
| accessIPv4 | |
| accessIPv6 | |
| progress | 0 |
| OS-EXT-STS:power_state | 0 |
| config_drive | |
| metadata | {} |
+------------------------+---------------------------------------------+
How do I set OS-DCF:diskConfig to auto so the full disk is partitioned automatically?
Make sure you have os-diskconfig-python-novaclient-ext installed. If it's not, pip install it! It should come as part of installing rackspace-novaclient.
$ pip install os-diskconfig-python-novaclient-ext
Next up, use the --disk-config=AUTO option:
$ nova boot server01 --disk-config=AUTO --image 62df001e-87ee-407c-b042-6f4e13f5d7e1 --flavor performance2-60
Note that this is an extension by Rackspace, so if this is for a separate OpenStack deployment your provider needs the server side extension as well.
Big note: If you do the partitioning yourself, you are able to have non-EXT3 file systems, multiple partitions, and it lets you manage the disk configuration.

Resources