Product version: Plesk Onyx 17.5.3 Update #47
Update date: 2018/05/10 15:21
Build date: 2017/03/17 16:00
OS version: CentOS 7.4.1708
Revision: 55d1b49a272f44666e1920eca8b6e4da449a38cd
Architecture: 64-bit
Wrapper version: 1.2
Issue:
Event handler do not seem to be executed after domain creation or domain status update.
How to reproduce:
1. Create a simple custom script that logs to syslog when called:
	
	
	
		
2. Set and check script permissions:
	
	
	
		
3. Add event handler:
	
	
	
		
4. Add a subscription or domain through Plesk
5. The script is not executed by the event handler, it does not show anything in the syslog:
	
	
	
		
----------
I want to use a simple script to write all Plesk domains to a text file. This file should be updated when a domain is created or deleted. How can I use event handlers to do this?
Why is the event handler example above not executing?
				
			Update date: 2018/05/10 15:21
Build date: 2017/03/17 16:00
OS version: CentOS 7.4.1708
Revision: 55d1b49a272f44666e1920eca8b6e4da449a38cd
Architecture: 64-bit
Wrapper version: 1.2
Issue:
Event handler do not seem to be executed after domain creation or domain status update.
How to reproduce:
1. Create a simple custom script that logs to syslog when called:
		Code:
	
	# cat /usr/sbin/plesk-test
#!/bin/bash
# Test working of Plesk event handler by logging simple message to syslog
logger -it "plesk-test" "Plesk handler was called"
exit 02. Set and check script permissions:
		Code:
	
	# chmod +x /usr/sbin/plesk-test
# stat /usr/sbin/plesk-test
  File: ‘/usr/sbin/plesk-test’
  Size: 150           Blocks: 8          IO Block: 4096   regular file
Device: fd00h/64768d    Inode: 580006      Links: 1
Access: (0755/-rwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Context: unconfined_u:object_r:bin_t:s0
Access: 2018-05-18 16:08:11.933520672 +0200
Modify: 2018-05-18 15:07:52.607733925 +0200
Change: 2018-05-18 16:11:04.956102696 +0200
 Birth: -3. Add event handler:
		Code:
	
	# stat /opt/psa/var/root.event.handler.lock
stat: cannot stat ‘/opt/psa/var/root.event.handler.lock’: No such file or directory
# plesk bin event_handler --list-events | grep 112
112                      Domain created
# plesk bin event_handler --create -command '/usr/sbin/plesk-test > /dev/null' -priority 0 -user root -event 112
# plesk bin event_handler --list
   Id               1
   Name             Service stopped
   Priority         0
   User             root
   Command          /usr/local/psa/admin/bin/modules/watchdog/wd --unmonit-service=<new_service> --plesk-name
   Id               2
   Name             Service started
   Priority         0
   User             root
   Command          /usr/local/psa/admin/bin/modules/watchdog/wd --monit-service=<new_service> --plesk-name
   Id               4
   Name             Domain created
   Priority         0
   User             root
   Command          /usr/sbin/plesk-test > /dev/null4. Add a subscription or domain through Plesk
5. The script is not executed by the event handler, it does not show anything in the syslog:
		Code:
	
	# grep 'plesk-test' /var/log/messages----------
I want to use a simple script to write all Plesk domains to a text file. This file should be updated when a domain is created or deleted. How can I use event handlers to do this?
Why is the event handler example above not executing?
			
				Last edited: 
			
		
	
								
								
									
	
								
							
							 
 
		 
 
		 
 
		 
 
		 
 
		