Tuesday, October 3, 2023
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 411  / 1 Year ago, fri, may 27, 2022, 2:17:24

I have one jar which i need to run on startup and no matter whatever user is logged in and that need to take that user name automatcally
here this code can take user name



echo $(logname)


and this command i need to run on start up.



java -jar /home/(username)/VISDashboard2014/VISDashboard.jar


so now how can i take dynamically username in to this command.?


More From » 12.04

 Answers
7

You can use following conmand:



In which $USER is environment variable which gives username



java -jar /home/$USER/VISDashboard2014/VISDashboard.jar

[#24343] Friday, May 27, 2022, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
calronze

Total Points: 0
Total Questions: 110
Total Answers: 112

Location: Belarus
Member since Thu, Aug 11, 2022
1 Year ago
;