can anyone please assist with this code? I never know how many quotes to use or where to place them. VB is complaining about the lines after the #/bin/bash line
ok i got it down to just one line i cant figure out
Code:
TextFile.WriteLine ("if echo "$temp" | grep -q " & rs("Coin_Name") & "; then")
grrr still trying though
Code:
Private Sub Command113_Click()Dim strpath As String
strpath = CurrentProject.Path & "\"
Dim cf As String
cf = strpath & "usr\local\bin\daemonstart.sh"
' Create the new file
'Write the conf file
Dim fso, TextFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set TextFile = fso.CreateTextFile(cf, True)
TextFile.WriteLine ("# Generated by OneBTCPlace.com")
'Traverse through all coins
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("SELECT * FROM Table1")
'Check to see if the recordset actually contains rows
If Not (rs.EOF And rs.BOF) Then
rs.MoveFirst 'Unnecessary in this case, but still a good habit
Do Until rs.EOF = True
TextFile.WriteLine ("#!/bin/bash")
TextFile.WriteLine ("temp=$(ps aux | grep & rs("Coin_Name") & | grep -v grep))
TextFile.WriteLine ("echo $temp")
TextFile.WriteLine ("#if [[ "$temp" == * & rs("Coin_Name") & * ]]")
TextFile.WriteLine ("if echo "$temp" | grep -q " & rs("Coin_Name") & "; then")
TextFile.WriteLine ("echo " & rs("Coin_Name") & Already Running!"")
TextFile.WriteLine ("else")
TextFile.WriteLine (" & rs("Coin_Name") & -daemon")
TextFile.WriteLine ("fi")
'Move to the next record. Don't ever forget to do this.
rs.MoveNext
Loop
End Sub