Executing PowerShell script on Python - python-3.x

I am trying to execute the following Windows PowerShell script (Get-Event-Logs.ps1):
Get-EventLog system -After (Get-Date).AddDays(-30) -Instance 44
It should output something like this:
Index Time EntryType Source InstanceID Message
----- ---- --------- ------ ---------- -------
21056 Nov 27 15:47 Information Microsoft-Windows... 44 Windows Update started downloading an update.
21045 Nov 27 15:23 Information Microsoft-Windows... 44 Windows Update started downloading an update.
21044 Nov 27 15:23 Information Microsoft-Windows... 44 Windows Update started downloading an update.
21043 Nov 27 15:23 Information Microsoft-Windows... 44 Windows Update started downloading an update.
21042 Nov 27 15:23 Information Microsoft-Windows... 44 Windows Update started downloading an update.
21005 Nov 27 12:18 Information Microsoft-Windows... 44 Windows Update started downloading an update.
20940 Nov 26 18:42 Information Microsoft-Windows... 44 Windows Update started downloading an update.
I am executing in python with the following code:
import subprocess, sys
p = subprocess.Popen(['powershell.exe', 'Get-Event-Logs.ps1'], stdout=subprocess.PIPE,universal_newlines=True)
out, err = p.communicate()
print(out)
All I'm getting is a blank.
Where am I going wrong?

Related

ERROR could not load library "/usr/pgsql-11/lib/postgres_fdw.so"

I'm getting the following error when attempting to access a foreign table.
ERROR: could not load library "/usr/pgsql-11/lib/postgres_fdw.so": /usr/pgsql-11/lib/postgres_fdw.so: undefined symbol: TimestampDifferenceMilliseconds
This was not a problem until yesterday, when someone used yum to update a bunch of stuff under sudo permissions.
The file, postgres_fdw.so, is in the listed location.
Relevant Information:
I've been using psql (11.11, server 11.5) for a few months now.
I had previously been using psql (9.2.24, server 11.5)
foreign data wrappers had been constructed and linked before the update
I'm running CentOS 7 (centos-release-7-9.2009.1.el7.centos.x86_64)
I am aware that there are at least two instances of psql installed on the server
someone on sudo recently ran yum update -y; looking at the logs from the update, the following lines contain "postgresql"
Mar 05 10:00:22 Updated: postgresql-libs-9.2.24-4.el7_8.x86_64
Mar 05 10:00:22 Updated: postgresql11-libs-11.11-1PGDG.rhel7.x86_64
Mar 05 10:00:27 Updated: postgresql-9.2.24-4.el7_8.x86_64
Mar 05 10:02:36 Updated: postgresql11-11.11-1PGDG.rhel7.x86_64
Mar 05 10:02:45 Updated: postgresql11-server-11.11-1PGDG.rhel7.x86_64
Mar 05 10:06:11 Updated: postgresql11-contrib-11.11-1PGDG.rhel7.x86_64
Mar 05 10:06:22 Updated: postgresql-server-9.2.24-4.el7_8.x86_64
Mar 05 10:06:51 Updated: postgresql-contrib-9.2.24-4.el7_8.x86_64
Mar 05 10:06:54 Updated: postgresql10-libs-10.16-1PGDG.rhel7.x86_64

Apache LockFile issue

I am trying to migrate from Apache 2.2 on Debian 7 to Apache 2.4 on CentOS 7.
when httpd starts, it fails to start as below.
root# journalctl -xe
Jun 23 14:26:04 ww-test httpd[17716]: AH00526: Syntax error on line 47 of /etc/httpd/conf/httpd.conf:
Jun 23 14:26:04 ww-test httpd[17716]: Invalid command 'LockFile', perhaps misspelled or defined by a module not included in the server configuration
Jun 23 14:26:04 ww-test systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Jun 23 14:26:04 ww-test kill[17718]: kill: cannot find process ""
Jun 23 14:26:04 ww-test systemd[1]: httpd.service: control process exited, code=exited status=1
Jun 23 14:26:04 ww-test systemd[1]: Failed to start The Apache HTTP Server.
vi httpd.conf
45 # The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
46 #
47 LockFile ${APACHE_LOCK_DIR}/accept.lock
48
I installed the related package as below although I am not sure if it is the right one.
============================================================================================================================================================================================
Package Arch Version Repository Size
============================================================================================================================================================================================
Installing:
lockfile-progs x86_64 0.1.15-7.el7 /lockfile-progs-0.1.15-7.el7.x86_64 50 k
Installing for dependencies:
liblockfile x86_64 1.08-17.el7 base 21 k
Transaction Summary
Thanks for reading it.
Replace this line:
LockFile ${APACHE_LOCK_DIR}/accept.lock
To:
Mutex file:/var/httpd/locks default
Directives AcceptMutex, LockFile, RewriteLock, SSLMutex, SSLStaplingMutex, and WatchdogMutexPath have been replaced with a single Mutex directive. You will need to evaluate any use of these removed directives in your 2.2 configuration to determine if they can just be deleted or will need to be replaced using Mutex

issue while installing jenkins in Ubuntu 16.04

Tried installing jenkins by following the below mentioned link but end up facing the following issue
https://www.liquidweb.com/kb/installing-jenkins-on-ubuntu-16-04/
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
jenkins
E: Sub-process /usr/bin/dpkg returned an error code
Reinstalled the dpkg again and tried installing jenkins but end up facing the same issue
Could someone please guide me to resolve this issue?
uday#uday:~$ sudo apt-get install jenkins
Reading package lists... Done
Building dependency tree
Reading state information... Done
jenkins is already the newest version (2.204.1).
The following packages were automatically installed and are no longer required:
linux-headers-4.4.0-57 linux-headers-4.4.0-57-generic
linux-image-4.4.0-57-generic
linux-image-extra-4.4.0-57-generic snapd-login-service
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up jenkins (2.204.1) ...
Job for jenkins.service failed because the control process exited with error code. See "systemctl status jenkins.service" and "journalctl -xe" for details.
invoke-rc.d: initscript jenkins, action "start" failed.
● jenkins.service - LSB: Start Jenkins at boot time
Loaded: loaded (/etc/init.d/jenkins; bad; vendor preset: enabled)
Active: failed (Result: exit-code) since Sun 2019-12-22 20:09:44 IST; 4ms ago
Docs: man:systemd-sysv-generator(8)
Process: 31293 ExecStart=/etc/init.d/jenkins start (code=exited, status=1/FAILURE)
Dec 22 20:09:44 uday jenkins[31293]: Found an incorrect Jav...
Dec 22 20:09:44 uday jenkins[31293]: Java version found:
Dec 22 20:09:44 uday jenkins[31293]: java version "1.7.0_95"
Dec 22 20:09:44 uday jenkins[31293]: OpenJDK Runtime Enviro...
Dec 22 20:09:44 uday jenkins[31293]: OpenJDK Server VM (bui...
Dec 22 20:09:44 uday jenkins[31293]: Aborting
Dec 22 20:09:44 uday systemd[1]: jenkins.service: Control p...
Dec 22 20:09:44 uday systemd[1]: Failed to start LSB: Start...
Dec 22 20:09:44 uday systemd[1]: jenkins.service: Unit ente...
Dec 22 20:09:44 uday systemd[1]: jenkins.service: Failed wi...
Hint: Some lines were ellipsized, use -l to show in full.
dpkg: error processing package jenkins (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
jenkins
E: Sub-process /usr/bin/dpkg returned an error code (1)
Tried getting the Output of journalctl -xe command to observe the issue
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit jenkins.service has begun starting up.
Dec 23 08:21:32 uday jenkins[3105]: Found an incorrect Java version
Dec 23 08:21:32 uday jenkins[3105]: Java version found:
Dec 23 08:21:32 uday jenkins[3105]: java version "1.7.0_95"
Dec 23 08:21:32 uday jenkins[3105]: OpenJDK Runtime Environment (IcedTea 2.6.4) (7u95-2.6.4-3)
Dec 23 08:21:32 uday jenkins[3105]: OpenJDK Server VM (build 24.95-b01, mixed mode)
Dec 23 08:21:32 uday jenkins[3105]: Aborting
Dec 23 08:21:32 uday systemd[1]: jenkins.service: Control process exited, code=exited status=1
Dec 23 08:21:32 uday systemd[1]: Failed to start LSB: Start Jenkins at boot time.
-- Subject: Unit jenkins.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit jenkins.service has failed.
--
-- The result is failed.
Dec 23 08:21:32 uday systemd[1]: jenkins.service: Unit entered failed state.
Dec 23 08:21:32 uday systemd[1]: jenkins.service: Failed with result 'exit-code'.
Dec 23 08:21:33 uday sudo[3002]: pam_unix(sudo:session): session closed for user root
Dec 23 08:21:43 uday sudo[3170]: uday : TTY=pts/1 ; PWD=/home/uday ; USER=root ; COMMAND=/bin/journalctl -xe
Dec 23 08:21:43 uday sudo[3170]: pam_unix(sudo:session): session opened for user root by (uid=0)
~
I think the new version of Jenkins only supports OpenJDK-8 So you should clean all the installed Java and Jenkins and reinstall it according to this post https://techpostal.blogspot.com/2020/01/jenkins-installation-in-ubuntu-1804.html hope it will help you..

Gnome terminal 3.22 not starting

I just updated my arch linux to gnome 3.22 and it broke many things.
Most annoying is that gnome-terminal won't start.
I checked journalctl and found that :
oct. 18 15:11:05 jarvis dbus-daemon[727]: Successfully activated service 'org.gnome.Terminal'
oct. 18 15:11:05 jarvis systemd[711]: Started GNOME Terminal Server.
oct. 18 15:11:06 jarvis org.gnome.Shell.desktop[745]: Window manager warning: Could not import pending buffer, ignoring commit: Failed to create texture 2d due to size/format constraints
oct. 18 15:11:06 jarvis gnome-terminal-[1569]: Error flushing display: Broken pipe
oct. 18 15:11:06 jarvis kernel: traps: gnome-terminal-[1569] trap int3 ip:7f21f3389ff1 sp:7ffd9c3e2bb0 error:0
oct. 18 15:11:06 jarvis systemd[1]: Started Process Core Dump (PID 1592/UID 0).
oct. 18 15:11:06 jarvis systemd[711]: gnome-terminal-server.service: Main process exited, code=dumped, status=5/TRAP
oct. 18 15:11:06 jarvis systemd[711]: gnome-terminal-server.service: Unit entered failed state.
oct. 18 15:11:06 jarvis systemd[711]: gnome-terminal-server.service: Failed with result 'core-dump'.
oct. 18 15:11:06 jarvis systemd-coredump[1593]: Process 1569 (gnome-terminal-) of user 1000 dumped core.
Stack trace of thread 1569:
#0 0x00007f21f3389ff1 n/a (libglib-2.0.so.0)
#1 0x00007f21f338c731 g_log_writer_default (libglib-2.0.so.0)
#2 0x00007f21f338ab8c g_log_structured_array (libglib-2.0.so.0)
...
Going on and on on different libc.so.6 calls.
I can't find how to fix this.
Does any one have an idea of what happened ? and of what I should do ?
Try switch login screen to use Xorg,
edit file: /etc/gdm/custom.conf and uncomment WaylandEnable=false:
[daemon]
# Uncoment the line below to force the login screen to use Xorg
# WaylandEnable=false

Cann't receive REMOTE host log messages with Chainsaw (localhost messages just OK)

I did a logger with programmatically configured SocketAppender for Chainsaw. I successfully receive messages in the SimpleReceiver of Chainsaw from code running on localhost, but from remote host i'm just getting like
63 Fri Sep 23 14:44:08 MSD
2011 INFO org.apache.log4j.chainsaw.messages.MessageCenter Connection
received from
my.host.com:50299 Chainsaw-WorkerThread log chainsaw
68 Fri Sep 23 15:12:22 MSD
2011 INFO org.apache.log4j.chainsaw.messages.MessageCenter Connection
lost! :: null Chainsaw-WorkerThread
log chainsaw 69 Fri Sep 23 15:12:22 MSD
2011 DEBUG org.apache.log4j.net.SocketReceiver accepted
socket Chainsaw-WorkerThread log chainsaw
70 Fri Sep 23 15:12:22 MSD
2011 DEBUG org.apache.log4j.net.SocketReceiver socket not null -
creating and starting
socketnode Chainsaw-WorkerThread log chainsaw
71 Fri Sep 23 15:12:22 MSD
2011 DEBUG org.apache.log4j.net.SocketReceiver w*aiting to accept
socket* Chainsaw-WorkerThread log chainsaw
but no tab with log messages from remote host. What's wrong? No firewall is running.
Tested with v2 and v2.1-trunk-today.
Solved yesterday. Log level in big app's plugin wasn't set correctly.

Resources