forked from distok/cutthecord
		
	customversion: make script less likely to error in systemd services
This commit is contained in:
		
							parent
							
								
									9fd72d479e
								
							
						
					
					
						commit
						3f97a21677
					
				
					 1 changed files with 10 additions and 3 deletions
				
			
		| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
#!/bin/env python3
 | 
					#!/bin/env python3
 | 
				
			||||||
import sys
 | 
					import sys
 | 
				
			||||||
import os
 | 
					import getpass
 | 
				
			||||||
import datetime
 | 
					import datetime
 | 
				
			||||||
import socket
 | 
					import socket
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -18,8 +18,15 @@ customtext = customtext.strip(",")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
timestamp = str(datetime.datetime.utcnow()).split('.')[0] + " UTC"
 | 
					timestamp = str(datetime.datetime.utcnow()).split('.')[0] + " UTC"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
customtext += ", built on {}@{} at {}".format(os.getlogin(),
 | 
					try:
 | 
				
			||||||
                                              socket.gethostname(),
 | 
					    uname = getpass.getuser()
 | 
				
			||||||
 | 
					except:
 | 
				
			||||||
 | 
					    uname = "unknown"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					hostname = socket.gethostname().split(".")[0]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					customtext += ", built on {}@{} at {}".format(uname,
 | 
				
			||||||
 | 
					                                              hostname,
 | 
				
			||||||
                                              timestamp)
 | 
					                                              timestamp)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Replace the target string
 | 
					# Replace the target string
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue